Prompt
How do I add biometrics for sign-in in my app?
Latest observation
Oct 28, 2026
OpenAI APIWeb search: off
You can add biometrics to your app by using the OS’s biometric APIs rather than trying to handle fingerprint/face data yourself.
What “biometrics for sign-in” usually means
There are two common patterns:
-
Unlock an already signed-in session
- User signs in with password/OTP once.
- You store a session token securely.
- Later, biometrics unlock the app by releasing that token.
-
Approve sign-in with biometrics
- User starts sign-in on the device.
- The OS prompts for Face ID / Touch ID / fingerprint.
- If successful, your app continues authentication.
Recommended approach
Mobile apps
Use the platform APIs:
- iOS:
LocalAuthentication(LAContext) - Android:
BiometricPrompt - Cross-platform
- Flutter:
local_auth - React Native:
react-native-biometricsorexpo-local-authentication - .NET MAUI/Xamarin: platform-specific biometric plugins
- Capacitor/Cordova: biometric plugins
- Flutter:
Important security rule
Do not collect or store raw biometric data yourself.
Biometric matching should happen on the device through the OS, and your app should only receive a success/failure result.
Typical implementation flow
- User signs in normally the first time.
- You generate/store a refresh token or session token in secure storage:
- iOS Keychain
- Android Keystore / EncryptedSharedPreferences
- Ask user if they want to enable biometrics.
- When they return, show biometric prompt.
- If successful, use the secure token to sign them in.
iOS example
Use LAContext:
import LocalAuthentication
let context = LAContext()
var error: NSError?
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics,
localizedReason: "Log in to your account") { success, authError in
DispatchQueue.main.async {
if success {
// Unlock session / continue login
} else {
// Handle failure
}
}
}
}
Android example
Use BiometricPrompt:
val executor = ContextCompat.getMainExecutor(this)
val biometricPrompt = BiometricPrompt(this, executor,
object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
super.onAuthenticationSucceeded(result)
// Unlock session / continue login
}
})
val promptInfo = BiometricPrompt.PromptInfo.Builder()
.setTitle("Sign in")
.setSubtitle("Use your fingerprint or face")
.setNegativeButtonText("Cancel")
.build()
biometricPrompt.authenticate(promptInfo)
If you want true “passwordless” sign-in
Consider passkeys (FIDO2/WebAuthn). They use device biometrics to unlock a private key, and are more secure and modern than storing reusable passwords.
Best practices
- Always provide a fallback: PIN, password, or device credential
- Require biometrics only after initial account verification
- Use secure storage for tokens
- Re-prompt after app restart or timeout
- Support users with no biometric hardware
- Handle enrollment changes: if fingerprints/face data changes, re-verify identity
If you tell me your stack (iOS, Android, Flutter, React Native, web, etc.), I can show you the exact implementation.