Implementing device lock–based user authentication
This commit is contained in:
18
src/screen/GetPinAuthenticate.tsx
Normal file
18
src/screen/GetPinAuthenticate.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
import ReactNativeBiometrics from 'react-native-biometrics';
|
||||
|
||||
const rnBiometrics = new ReactNativeBiometrics({
|
||||
allowDeviceCredentials: true, // IMPORTANT
|
||||
});
|
||||
|
||||
const authenticateWithDevicePin = async () => {
|
||||
const { success } = await rnBiometrics.simplePrompt({
|
||||
promptMessage: 'Authenticate using device lock',
|
||||
});
|
||||
|
||||
if (success) {
|
||||
console.log('User authenticated using device PIN / Pattern / FaceID');
|
||||
} else {
|
||||
console.log('Authentication cancelled');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user