Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Pin/Password/Pattern Integration

I have went through the local_auth package and it works fine, but it does not have an option to authenticate with password or pin. Help appreciated!

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

So this is the example code and you can use biometric authentication but what about the default Pin/Password authentication that is also present with fingerprint.

like image 759
Keshava Muraari Avatar asked Aug 27 '18 10:08

Keshava Muraari


1 Answers

For security reason, mobile (iOS/Android) will only authenticate user by biometrics, not system password/pin. If you want to let user authenticate by other methods than biometrics, the app itself must store and process (encrypted) credential which is totally separated from system password/pin.

You can see this behavior (to use system-biometrics AND app-specific credential) in many bank/financial related app, such as https://play.google.com/store/apps/details?id=com.konylabs.capitalone&hl=en

like image 120
TruongSinh Avatar answered Nov 11 '22 07:11

TruongSinh