Created
August 2, 2022 06:13
-
-
Save OkancanCosar/74d49890552e90602a5712c242f7c12c to your computer and use it in GitHub Desktop.
LocalAuthentication with expo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
expo > ios > infoPlist | |
"NSFaceIDUsageDescription": "This app use face id authentication." | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as LocalAuthentication from 'expo-local-authentication' | |
useEffect(() => { | |
(async () => { | |
const compatible: boolean = await LocalAuthentication.hasHardwareAsync(); | |
const savedBiometrics: boolean = await LocalAuthentication.isEnrolledAsync(); | |
const biometricAuth: LocalAuthentication.LocalAuthenticationResult = await LocalAuthentication.authenticateAsync({ | |
promptMessage: 'Login with Biometrics', | |
disableDeviceFallback: true, | |
cancelLabel: "cancel", | |
fallbackLabel: "fallback", | |
requireConfirmation: false | |
}); | |
console.log("⚡️ ", { | |
compatible, | |
savedBiometrics, | |
biometricAuth, | |
}); | |
})(); | |
}, []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment