Expo

Get Started
API Reference

LocalAuthentication

expo-local-authentication allows you to use FaceID and TouchID (iOS) or the Biometric Prompt (Android) to authenticate the user with a face or fingerprint scan.

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb
Pending

Installation

expo install expo-local-authentication

If you're installing this in a bare React Native app, you should also follow these additional installation instructions.

On Android, this module requires permissions to access the biometric data for authentication purposes. The USE_BIOMETRIC and USE_FINGERPRINT permissions are automatically added.

import * as LocalAuthentication from 'expo-local-authentication';

  • options (LocalAuthenticationOptions)

Attempts to authenticate via Fingerprint/TouchID (or FaceID if available on the device).

Note: Apple requires apps which use FaceID to provide a description of why they use this API.

If you try to use FaceID on an iPhone with FaceID without providing infoPlist.NSFaceIDUsageDescription in app.json, the module will authenticate using device passcode. For more information about usage descriptions on iOS, see Deploying to App Stores.

  • Promise<LocalAuthenticationResult>

Returns a promise which fulfils with LocalAuthenticationResult.


(Android Only) Cancels authentication flow.


Determine what kind of authentication is enrolled on the device.

Returns a promise which fulfils with SecurityLevel.

Note: On Android devices prior to M, SECRET can be returned if only the SIM lock has been enrolled, which is not the method that authenticateAsync prompts.

Determine whether a face or fingerprint scanner is available on the device.

Returns a promise which fulfils with a boolean value indicating whether a face or fingerprint scanner is available on this device.


Determine whether the device has saved fingerprints or facial data to use for authentication.

Returns a promise which fulfils to boolean value indicating whether the device has saved fingerprints or facial data for authentication.


Determine what kinds of authentications are available on the device.

Returns a promise which fulfils to an array containing AuthenticationTypes.

Devices can support multiple authentication methods- i.e. [1,2] means the device supports both fingerprint and facial recognition. If none are supported, this method returns an empty array.

NameTypeDescription
cancelLabel
(optional)
stringAllows to customize the default Cancel label shown.
disableDeviceFallback
(optional)
booleanAfter several failed attempts the system will fallback to the device passcode. This setting allows you to disable this option and instead handle the fallback yourself. This can be preferable in certain custom authentication workflows. This behaviour maps to using the iOS LAPolicyDeviceOwnerAuthenticationWithBiometrics policy rather than the LAPolicyDeviceOwnerAuthentication policy. Defaults to false.
fallbackLabel
(optional)
stringiOS only. Allows to customize the default Use Passcode label shown after several failed authentication attempts. Setting this option to an empty string disables this button from showing in the prompt.
promptMessage
(optional)
stringA message that is shown alongside the TouchID or FaceID prompt.

NameTypeDescription
successtrue-
NameTypeDescription
errorstring-
successfalse-
warning
(optional)
string-

  • AuthenticationType.FINGERPRINT : 1 - Indicates fingerprint support.
  • AuthenticationType.FACIAL_RECOGNITION : 2 - Indicates facial recognition support.
  • AuthenticationType.IRIS : 3 - Android-only. Indicates iris recognition support.

  • SecurityLevel.NONE : 0 - Indicates no enrolled authentication.
  • SecurityLevel.SECRET : 1 - Indicates non-biometric authentication (e.g. PIN, Pattern).
  • SecurityLevel.BIOMETRIC : 2 - Indicates biometric authentication.