Flutter引脚/密码/图案集成

时间:2018-08-27 10:17:33

标签: flutter localauthentication

我已经通过了local_auth程序包,它可以正常工作,但是它没有使用密码或密码进行身份验证的选项。帮助表示赞赏!

String _authorized = 'Not Authorized';//Start

Future<Null> _authenticate() async {
    final LocalAuthentication auth = new LocalAuthentication();
    bool authenticated = false;
    try {
        authenticated = await auth.authenticateWithBiometrics(
        localizedReason: 'Scan your fingerprint to authenticate',
        useErrorDialogs: true,
        stickyAuth: false);
        authenticated = await auth.authenticateWithBiometrics(localizedReason: 'Authenticate');
    } on PlatformException catch (e) {
        print(e);
    }
    if (!mounted) return;

    setState(() {
      _authorized = authenticated ? 'Authorized' : 'Not Authorized';
    });
}//End

这是示例代码,您可以使用生物识别身份验证,但是指纹中还包含默认的Pin / Password身份验证。

1 个答案:

答案 0 :(得分:2)

出于安全原因,移动版(iOS / Android)仅通过生物识别技术对用户进行身份验证,不通过系统密码/ PIN 进行身份验证。如果您想让用户通过生物识别方法以外的其他方法进行身份验证,则应用程序本身必须存储和处理(加密的)凭据,该凭据与系统密码/密码完全分开。

您可以在许多与银行/金融相关的应用程序(例如https://play.google.com/store/apps/details?id=com.konylabs.capitalone&hl=en

中看到此行为(使用系统生物学和特定于应用程序的凭据)