【发布时间】:2020-04-12 19:49:54
【问题描述】:
我正在尝试使用带有 Expo 的 React-native 在 Android 上实现生物特征认证(faceID/指纹)。
使用LocalAuthentication.authenticateAsync() 函数,用户可以使用他的生物特征进行身份验证。但如果失败,用户必须再次按下生物特征认证。
所以我尝试了一个使用 recursif 或 do while 循环的小技巧,但结果很奇怪:
const scanFingerPrint = async () => {
try {
const results = await DeviceService.biometricAuthentication();
if (results.success) {
SecureStoreService.getCredential()
.then(credentials => onScan(credentials));
} else {
ShakeAnimation(animatedValueModal);
return scanFingerPrint();
}
} catch (e) {
console.log(e);
}
};
使用此代码,如果用户生物特征认证失败,它将无限传递“else”...
所以我想知道如何在 android 上处理它。
【问题讨论】:
标签: react-native expo fingerprint biometrics