Skip to main content

expo-local-authentication

Version: 55.0.6 Provides an API for Face ID and Touch ID (iOS) or the Fingerprint API (Android) to authenticate the user with a face or fingerprint scan.

Installation

Usage

API Reference

Methods

() => Promise<boolean>
Checks if device has biometric authentication hardware
() => Promise<boolean>
Checks if user has enrolled biometric records
(options?: LocalAuthenticationOptions) => Promise<LocalAuthenticationResult>
Authenticates user with biometricsOptions:
  • promptMessage: Message shown in authentication dialog
  • fallbackLabel: iOS fallback button text
  • cancelLabel: Android cancel button text
  • disableDeviceFallback: Disable device PIN fallback
  • requireConfirmation: Require explicit user confirmation (Android)
() => Promise<AuthenticationType[]>
Gets supported authentication typesReturns array of: FINGERPRINT, FACIAL_RECOGNITION, IRIS
() => Promise<SecurityLevel>
Gets security level of enrolled authenticationReturns: NONE, SECRET, BIOMETRIC
() => void
Cancels authentication prompt (Android only)

Types

LocalAuthenticationResult

boolean
Whether authentication was successful
string | undefined
Error message if authentication failed
string | undefined
Warning message

LocalAuthenticationOptions

string
Message displayed in authentication dialog
string
iOS: Text for fallback button
string
Android: Text for cancel button
boolean
Disable device PIN/pattern fallback. Default: false
boolean
Android: Require explicit confirmation after biometric scan. Default: true

Enums

Examples

Basic Authentication

Check Capability

Determine Authentication Type

Protect Sensitive Action

With SecureStore Integration

Complete Example

Platform Support

Permissions

iOS

Add to app.json:

Android

Permissions automatically added:
  • USE_BIOMETRIC (Android 9+)
  • USE_FINGERPRINT (Android 6-8)

Best Practices

  1. Check Availability: Always check hardware and enrollment before authenticating
  2. Graceful Fallback: Provide alternative authentication if biometrics fail
  3. Clear Prompts: Use descriptive promptMessage explaining why auth is needed
  4. Error Handling: Handle all authentication errors gracefully
  5. User Choice: Don’t force biometric auth; offer alternatives
Always check both hasHardwareAsync() and isEnrolledAsync() before attempting authentication.

Common Error Codes

  • user_cancel: User canceled authentication
  • system_cancel: System canceled (e.g., app backgrounded)
  • authentication_failed: Biometric scan failed
  • passcode_not_set: Device passcode not set
  • not_available: Biometric authentication not available

Resources