I would like to know how many attempts does 'Apple Biometric Framework' [FaceID and TouchID] provide on login failure using Biometric?

Can we change or customize the attempt count/ retry count? If yes, how ? If no, why?

I tried searching online but found few articles that tell more about how to implement the functionality but doesn't say much about attempt/count to retry login, via FaceID and Touch ID. Neither it say anything about customizing the retry count.

Thanks.

1

There are 1 best solutions below

0
Aravind P Unnithan On

No. We cannot change or customize the attempt count/retry count. It is system controlled.

Customization is not possible, but biometry can be re-enabled. Once the user fails the biometric authentication consecutive number of attempts, biometryLockout occurs. Once in lockout state, authentication can be triggered with the device passcode, and upon successful passcode attempt, biometric login will be available. It can be done with the method evaluatePolicy(_:localizedReason:reply:). LAPolicy.deviceOwnerAuthentication needs to be evaluated.

Sample code for unlocking biometric lockout:

    func unlockBiometricLockout(completion: @escaping (Bool) -> Void) {
       context.evaluatePolicy(LAPolicy.deviceOwnerAuthentication,
                              localizedReason: "Your device passcode is required to unlock Biometrics") { success, error in
         DispatchQueue.main.async {
            if success {
                completion(true)
            } else {
                completion(false)
            }
         }
       }
    }