Implementing device lock–based user authentication

This commit is contained in:
mansi-dev
2026-01-14 23:57:48 +05:30
parent 1723d072aa
commit 250f9286d6
3 changed files with 29 additions and 0 deletions

View 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');
}
};