Nazim Musa
Nazim Musa

Reputation: 11

Android Face ID authentication in React-Native

I am developing a React-Native Android app which requires biometrics authentication. Right now I am using 'react-native-keychain' library for that purpose. I integrated Fingerprint and everything works fine. But despite that I have saved Face unlock in my devices, I am not getting Face authentication as a supported type, only fingerprint. If I turn off Fingerprint from my device then I am getting nothing. I am wondering if there is anyway implementing Face authentication in Android. And if it is possible which devices support it ? I searched a lot, but didn't get clear answer. This is screenshot from 'react-native-keychain' docs.'react-native-keychain docs'

Upvotes: 1

Views: 2313

Answers (1)

Bhishak Sanyal
Bhishak Sanyal

Reputation: 129

I am using react-native-touch-id for my production app and it's something you can try. You can clearly check if faceid is supported for a device and decide accordingly.

const optionalConfigObject = {
      unifiedErrors: false // use unified error messages (default false)
      passcodeFallback: false // if true is passed, itwill allow isSupported to return an error if the device is not enrolled in touch id/face id etc. Otherwise, it will just tell you what method is supported, even if the user is not enrolled.  (default false)
    }
     
    TouchID.isSupported(optionalConfigObject)
      .then(biometryType => {
        // Success code
        if (biometryType === 'FaceID') {
            console.log('FaceID is supported.');
        } else {
            console.log('TouchID is supported.');
        }
      })
      .catch(error => {
        // Failure code
        console.log(error);
      });

Upvotes: 0

Related Questions