【发布时间】:2021-01-25 08:49:36
【问题描述】:
我是 React Native 的新手。我想在我的应用程序中实现人脸 id 和触摸 id 身份验证。在我的应用程序中,触摸 id 正在工作。但是面部识别码不起作用。我的面部身份验证代码如下:
callFinger(isLogin) {
TouchID.isSupported()
.then(biometryType => {
if (biometryType === 'TouchID') {
TouchID.authenticate('Unlock with your fingerprint').then(success => {
if (success) {
if (isLogin == "true")
this.callRedirect(isLogin);
else
this.callLoginApi();
}
}
);
} else if (biometryType === 'FaceID') {
TouchID.authenticate('Unlock with your FaceID').then(success => {
if (success) {
if (isLogin == "true")
this.callRedirect(isLogin);
else
this.callLoginApi();
}
}
);
} else if (biometryType === true) {
TouchID.authenticate('Unlock with your fingerprint').then(success => {
if (success) {
if (isLogin == "true")
this.callRedirect(isLogin);
else
this.callLoginApi();
}
}
);
}
else {
this.callRedirect(isLogin);
}
})
.catch(error => {
this.callRedirect(isLogin);
})
}
我正在将此链接用于触摸 ID,它对我有用。但在此链接中,面部识别码不起作用。 https://www.npmjs.com/package/react-native-touch-id
我也参考了下面的链接,但它也不起作用。 https://github.com/naoufal/react-native-touch-id/blob/master/examples/BiometricAuthExample/App.js
【问题讨论】:
标签: ios react-native authentication authorization