Installation
Requirements
| Platform | Minimum Version | Recommended |
|---|---|---|
| React Native | 0.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.
| Option | Type | Default | Description |
|---|---|---|---|
faceIDPermission | string | false | A generic Face ID message | The iOS NSFaceIDUsageDescription text. Pass false to leave Info.plist untouched (e.g. when you manage it via ios.infoPlist). |
With the plugin in place, the manual iOS Setup and Android Setup permission steps below are handled for you (Expo projects only).
iOS Setup
- Add permissions to
Info.plist:
<key>NSFaceIDUsageDescription</key>
<string>This app uses Face ID for secure authentication</string>
- Install iOS dependencies:
cd ios && pod install
Android Setup
- 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" />
- Ensure minimum SDK version in
android/app/build.gradle:
android {
compileSdkVersion 34
defaultConfig {
minSdkVersion 23
targetSdkVersion 34
}
}
- 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';