Skip to content

Latest commit

 

History

History
86 lines (63 loc) · 2.69 KB

local-authentication.mdx

File metadata and controls

86 lines (63 loc) · 2.69 KB
title description sourceCodeUrl packageName iconUrl platforms
LocalAuthentication
A library that provides functionality for implementing the Fingerprint API (Android) or FaceID and TouchID (iOS) to authenticate the user with a face or fingerprint scan.
expo-local-authentication
/static/images/packages/expo-local-authentication.png
android
ios

import APISection from '/components/plugins/APISection'; import { APIInstallSection } from '/components/plugins/InstallSection'; import { ConfigReactNative, ConfigPluginExample, ConfigPluginProperties, } from '/components/plugins/ConfigSection'; import { AndroidPermissions, IOSPermissions } from '/components/plugins/permissions';

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

Installation

Configuration in app.json/app.config.js

You can configure expo-local-authentication using its built-in config plugin if you use config plugins in your project (EAS Build or npx expo run:[android|ios]). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect.

{
  "expo": {
    "plugins": [
      [
        "expo-local-authentication",
        {
          "faceIDPermission": "Allow $(PRODUCT_NAME) to use Face ID."
        }
      ]
    ]
  }
}

<ConfigPluginProperties properties={[ { name: 'faceIDPermission', platform: 'ios', description: 'A string to set the NSFaceIDUsageDescription permission message.', default: '"Allow $(PRODUCT_NAME) to use Face ID"', }, ]} />

Learn how to configure the native projects in the installation instructions in the expo-local-authentication repository.

API

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

Permissions

Android

The following permissions are added automatically through this library's AndroidManifest.xml:

<AndroidPermissions permissions={['USE_BIOMETRIC', 'USE_FINGERPRINT']} />

iOS

The following usage description keys are used by this library:

<IOSPermissions permissions={['NSFaceIDUsageDescription']} />