I have implemented a react-native-fingerprint-scanner
, it's working for Touch Id
.
Now I wanted to add authentication for Touch ID, Face Id, Passcode for both platform
Is there any way to check whether your device support or not. Also, I have tried using react-native-touch-id
but it is not for Face Id
on android.
Is there any way to achieve this for both platforms (iOS/Android)?
Reference:Link
react-native-touch-id
should work for both TouchID and FaceID.
iOS allows the device to fall back to using the passcode, if faceid/touch is not available. this does not mean that if touchid/faceid fails the first few times it will revert to passcode, rather that if the former are not enrolled, then it will use the passcode.
from the docs
You can check to see if its supported first.
const optionalConfigObject = {
fallbackLabel: 'Show Passcode',
passcodeFallback: true,
}
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);
});