我目前正在使用世博认证来设置生物识别技术,到目前为止,它还在工作,但后备选项是使用手机PIN,但我不知道如何捕获我的密码是否成功,我在哪里可以捕获密码成功消息的反应本机?
见下面的代码
import * as LocalAuthentication from 'expo-local-authentication'
export const handleBiometricAuth = async () => {
const isBiometricAvailable = await LocalAuthentication.hasHardwareAsync()
if (!isBiometricAvailable) {
Alert.alert('Please, enter your pin', 'biometric auth not supported', [
{
text: 'ok',
onPress: () => console.log('fallback'),
},
])
return false
}
const savedBiometrics = await LocalAuthentication.isEnrolledAsync()
if (!savedBiometrics) {
Alert.alert('Attention', 'You should enable your biometrics or pin ', [
{
text: 'ok',
onPress: () => console.log('fallback'),
},
])
return false
}
const biometricAuth = await LocalAuthentication.authenticateAsync({
promptMessage: 'Login With Biometrics',
// cancelLabel: 'Cancel',
// disableDeviceFallback: true,
})
if (biometricAuth.success) {
return true
}
return false
}```发布于 2022-07-15 15:50:19
const biometricAuth = await LocalAuthentication.authenticateAsync({
promptMessage: 'Login With Biometrics',
cancelLabel: 'Cancel',
disableDeviceFallback: false,
})
if (biometricAuth.success) {
// ======> Here for both biometric or pin/passcode based successful login .success object will be returned
return true
}https://stackoverflow.com/questions/71307744
复制相似问题