Authenticating
LocalAuthentication.authenticate(options?) shows the system prompt and resolves with an AuthenticationResult when it closes. It never rejects.
const result = await LocalAuthentication.authenticate({
promptMessage: 'Confirm the transfer',
})
Device fallback
By default the user can fall back to the device passcode, PIN, pattern or password:
- iOS evaluates
deviceOwnerAuthentication, which offers the passcode after failed biometric attempts, or right away when no biometrics are enrolled. - Android allows
DEVICE_CREDENTIALin the same prompt (Android 10 and later), or uses the keyguard's confirm-credential screen (see Android versions).
Biometrics only
Set disableDeviceFallback to accept only biometrics:
const result = await LocalAuthentication.authenticate({
promptMessage: 'Unlock the vault',
cancelLabel: 'Not now',
disableDeviceFallback: true,
biometricsSecurityLevel: 'strong',
})
| Effect | iOS | Android |
|---|---|---|
| Policy | deviceOwnerAuthenticationWithBiometrics | Biometric authenticators only, no DEVICE_CREDENTIAL |
| Cancel button | cancelLabel, as always | Shown as the negative button, cancelLabel or "Cancel" |
| Fallback button | Hidden unless you pass fallbackLabel; tapping it gives user_fallback | None |
| Nothing enrolled | not_enrolled | not_enrolled |
| Android 8 and 9 | n/a | not_available |
Prompt text
| Option | iOS | Android |
|---|---|---|
promptMessage | The reason under the title. Defaults to "Authenticate". | The title. Defaults to the app name. |
promptSubtitle | Ignored. | The subtitle. |
promptDescription | Ignored. | The description. |
cancelLabel | The cancel button. | The cancel button, only with disableDeviceFallback. |
fallbackLabel | The fallback button after a failed attempt. '' hides it. | Ignored. |
Android biometric class
biometricsSecurityLevel picks the class Android accepts. weak, the default, allows Class 2 biometrics such as most face unlock implementations; strong allows only Class 3. iOS biometrics are always strong, so iOS ignores it. Android 10 cannot enforce the class.
requireConfirmation (Android, default true) asks the user to tap after a passive match such as face unlock. Set it to false to finish as soon as the face matches.
One prompt at a time
Only one prompt runs at a time. Calling authenticate while a prompt is open closes the earlier one, whose promise resolves with app_cancel, and opens the new one.
To close the prompt from code, for example on a timeout or navigation:
const pending = LocalAuthentication.authenticate({ promptMessage: 'Unlock' })
setTimeout(() => LocalAuthentication.cancelAuthenticate(), 30_000)
const result = await pending // { success: false, error: 'app_cancel' } after 30 s
cancelAuthenticate does nothing when no prompt is open.
:::info The keyguard screen cannot be closed
On Android 8 and 9, and on Android 10 without enrolled biometrics, the fallback is the keyguard's confirm-credential screen. cancelAuthenticate cannot close it: the promise resolves with app_cancel at once, the screen stays until the user leaves it, and its result is ignored.
:::