Skip to main content

Installation

Requirements

PlatformMinimum VersionRecommended
React Native0.68+0.75+

Supported Biometric Types

  • iOS: Face ID, Touch ID
  • Android: Fingerprint, Face Recognition, Iris Scanner
  • Fallback: Device PIN, Password, Pattern

Install the package

npm install @sbaiahmed1/react-native-biometrics
# or
yarn add @sbaiahmed1/react-native-biometrics

Expo

The library ships with an Expo config plugin. Instead of editing native files manually, add it to your app config — it sets NSFaceIDUsageDescription on iOS and adds the USE_BIOMETRIC / USE_FINGERPRINT permissions on Android during prebuild:

{
"expo": {
"plugins": [
[
"@sbaiahmed1/react-native-biometrics",
{
"faceIDPermission": "Allow $(PRODUCT_NAME) to use Face ID for secure authentication"
}
]
]
}
}

Then apply the changes by regenerating the native projects with npx expo prebuild. For a full regeneration use npx expo prebuild --clean — but note it deletes the ios/ and android/ directories, including any manual native edits. npx expo run:ios / run:android only run prebuild when the native directories are missing, so they won't pick up plugin changes on an existing project by themselves.

OptionTypeDefaultDescription
faceIDPermissionstring | falseA generic Face ID messageThe iOS NSFaceIDUsageDescription text. Pass false to leave Info.plist untouched (e.g. when you manage it via ios.infoPlist).
tip

With the plugin in place, the manual iOS Setup and Android Setup permission steps below are handled for you (Expo projects only).

iOS Setup

  1. Add permissions to Info.plist:
<key>NSFaceIDUsageDescription</key>
<string>This app uses Face ID for secure authentication</string>
  1. Install iOS dependencies:
cd ios && pod install

Android Setup

  1. Add permissions to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
  1. Ensure minimum SDK version in android/app/build.gradle:
android {
compileSdkVersion 34
defaultConfig {
minSdkVersion 23
targetSdkVersion 34
}
}
  1. Add ProGuard rules (if using ProGuard) in android/app/proguard-rules.pro:
-keep class androidx.biometric.** { *; }
-keep class com.sbaiahmed1.reactnativebiometrics.** { *; }

Importing Types on Non-Native Platforms

The AuthType and BiometricStrength enums can be safely imported from @sbaiahmed1/react-native-biometrics/types on non-mobile platforms (e.g. web), as this entry point does not load native modules.

import { AuthType, BiometricStrength } from '@sbaiahmed1/react-native-biometrics/types';