Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When Touch ID fails (wrong fingerprint) the passcode option does not appear. The text only shakes and shows the 'Cancel' button. #82

Open
DanielLeushuis opened this issue Aug 20, 2019 · 4 comments

Comments

@DanielLeushuis
Copy link

DanielLeushuis commented Aug 20, 2019

When Touch ID fails (wrong fingerprint) the passcode option does not appear. The text only shakes and shows the 'Cancel' button.

I Imported the module:

import { TouchID } from '@ionic-native/touch-id/ngx';

Injected the module into the constructor:

constructor(
    private touchId: TouchID
) {

}

And used the 'verifyFingerprint' method:

this.touchId.verifyFingerprint('Scan your fingerprint please').then(
    res => {
        console.log('Ok', res);
    }, err => {
        console.error('Error', err);
    }
);

I have Touch ID and a passcode setup on the (real) device. Am I missing a step?

@cvinodhkumar77
Copy link

I am also facing the same issue. Its working fine in iPhone6 OS version 10 but not in iPhone6+ OS version 12

@DanielLeushuis
Copy link
Author

Thanks for adding information. I can only test iOS 11+ since my Capacitor is configured like that now.

@DanielLeushuis
Copy link
Author

The docs (https://developer.apple.com/documentation/localauthentication/lapolicy/lapolicydeviceownerauthenticationwithbiometrics?language=objc) says 'To let the system handle the fallback option by asking for the device passcode (in iOS or watchOS) or the user’s password (in macOS), use the LAPolicyDeviceOwnerAuthentication policy instead.'

I will try changing LAPolicyDeviceOwnerAuthenticationWithBiometrics to LAPolicyDeviceOwnerAuthentication in TouchID.m. I will report back another day.

@DanielLeushuis
Copy link
Author

It had something to do with LAPolicyDeviceOwnerAuthentication but not by simply replacing the policies in the TouchID.m file.

This repo fixes the issues described above: https://github.com/didux-io/cordova-plugin-touch-id. I have also requested a pull for this repo.

Package on npm: https://www.npmjs.com/package/@didux-io/cordova-plugin-touch-id

Behavior now:

  1. User will be prompted for finger print if available
  2. User will be prompted for passcode or fingerprint after one failed finger print attempt
  3. User will be prompted for only the passcode if the fingerprint is disabled or if the fingerprint has been disabled by too many misuses.

I highly recommend using this package aswell: https://ionicframework.com/docs/native/pin-check with https://ionicframework.com/docs/native/open-native-settings

That library will check if the user has no passcode and provides you ways to navigate the user to set one, example code to use with that library:

import { PinCheck } from '@ionic-native/pin-check/ngx';
import { TouchID } from '@ionic-native/touch-id/ngx';
import { Platform } from '@ionic/angular';

.....

pinSetup = true;

constructor(
    private platform: Platform,
    private pinCheck: PinCheck,
    private touchId: TouchID
) {
      
}

openSecuritySettings() {
    if (this.platform.is('android')) {
        this.openNativeSettings.open('security');
    } else if (this.platform.is('ios')) {
        this.openNativeSettings.open('touch');
    }
}

checkLockScreenEnabled() {
    this.pinCheck.isPinSetup().then(
        () => {
           this.pinSetup = true;
        }, () => {
            this.pinSetup = false;
        }
    );
}

.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants