🗝️Biometrics & Credentials
Authenticate users with Face ID, Touch ID, or device passcode, and securely store and retrieve login credentials on the device.
What is Biometrics & Credentials?
Biometrics & Credentials gives your app two related capabilities: verifying the user's identity using the device's native biometric authentication (Face ID, Touch ID, or device passcode), and securely storing and retrieving login credentials on the device.
Credentials are stored in the device's secure storage - the iOS Keychain on iPhone and private Local Storage on Android. They are tied to your app's hostname, so they are only accessible from within your specific app.
Prerequisites
This feature is available in all plans. See all plans
Implementation
Choose your integration method below: Bubble.io Plugin (No-Code), JavaScript SDK (Code), or AI Agents (for AI-powered editors like Lovable, Base44, and Replit).
Initialization
Check Plugin
Before starting, verify if the Natively plugin is already installed in your Bubble project.
Open your Bubble editor and navigate to the Plugins tab in the left sidebar.
Check Installed Plugins: Look through your list of installed plugins for "Natively iOS & Android app builder".
If it IS installed: Check the version number. If an update is available (e.g., you see a button saying "Update"), click it to ensure you have the latest features and bug fixes.

If it is NOT installed: Click the + Add plugins button, search for "Natively", and click Install.

Check SDK
Before writing any logic, ensure the Natively SDK is correctly installed and up-to-date in your codebase.
Open your project's main HTML file (or header settings) and look for the Natively script tag inside the
<head>section.Install/Update: If missing or outdated, add the following code. You can specify the SDK version in the URL (e.g.,
@2.26.0).
Initialize the SDK
AI-powered editors like Lovable, Base44, and Replit use the JavaScript SDK to implement Natively features. Before implementing any feature, the Natively SDK must be initialized in your project.
Copy the line below and paste it into your AI agent to check and set up the Natively SDK in your project.
Setup Logic
[Element] Natively - Biometrics
Events:
User's identity verified - fires when biometric authentication succeeds.
User's identity verification failed - fires when biometric authentication fails.
User's credentials received - fires when credentials are successfully retrieved after biometric verification.
User's credentials not received - fires when credentials could not be retrieved after biometric verification.
User's credentials saved - fires when credentials are successfully saved after biometric verification.
User's credentials removed - fires when credentials are successfully removed from the device.
Biometrics supported - fires when Check biometrics support completes, and the device supports biometrics.
Biometrics not supported - fires when Check biometrics support completes, and the device does not support biometrics.
States:
User's login after biometric authentication. - the stored username/login(can be anything you're using for authentication) retrieved after successful biometric authentication.
User's password after biometric authentication - the stored password retrieved after successful biometric authentication.
User's device supports biometrics. - Yes/No. Whether the device supports biometric authentication.
User has stored credentials. - Yes/No. Whether credentials for this app are already stored on the device.
Actions:
Check biometrics support - checks whether the device supports biometric authentication:
allow_passcode- Yes/No. Allows users without Face ID/Touch ID to use the device passcode as a fallback.
Verify user's identity - triggers native biometric authentication to confirm the user's identity:
allow_passcode- Yes/No. Allows users without Face ID/Touch ID to use the device passcode as a fallback.
Get user's credentials - triggers biometric authentication and retrieves stored credentials on success:
allow_passcode- Yes/No. Allows users without Face ID/Touch ID to use the device passcode as a fallback.
Save user's credentials - triggers biometric authentication and saves credentials on success:
login- the username or email to store (can be any text);password- the password to store (can be any text);allow_passcode- Yes/No. Allows users without Face ID/Touch ID to use the device passcode as a fallback.
Remove user's credentials - removes stored credentials from the device. No biometric authentication required.
Clear user's credentials from element - clears credentials from the element state; call this after Get user's credentials.
AI-powered editors like Lovable, Base44, and Replit use the JavaScript SDK to implement Natively features.
Copy the line below and paste it into your AI agent.
Replace the placeholder at the beginning with a description of what you want to build - for example: "Add biometric login so returning users can sign in with Face ID or Touch ID instead of entering their password every time".
How to use
Check biometrics support before showing the option
Always call checkBiometricsSupport first to verify the device supports biometrics before showing a biometric login option. If the device doesn't support it, fall back to your standard login flow.
Check for stored credentials on app load
Call checkCredentials when the app loads to determine if the user has previously saved credentials. If credentials exist, you can offer a "Sign in with biometrics" button instead of showing the full login form.
Save credentials after a successful login
The right moment to save credentials is immediately after a successful standard login (email + password). Prompt the user to enable biometric login for next time - for example, with a checkbox or a prompt saying "Use Face ID for next login?". Update the stored credentials each time the user changes their password.
Use verifyUserIdentity for sensitive actions
Use verifyUserIdentity when you need to confirm the user's identity before a sensitive action - like viewing payment details, confirming a purchase, or accessing private data - without needing to retrieve stored credentials.
Always provide a fallback
Not all users have or want biometrics. Set allowPasscode to true to allow the device passcode as a fallback. Also give users the option to skip biometric login entirely and use their standard credentials instead.
Give users control over their credentials
Always provide a way for users to remove their stored credentials - for example, in your app's account settings. Call removeUserCredentials when the user signs out or disables biometric login.
Credentials are tied to the hostname
Stored credentials are linked to your app's hostname, not a specific user. If multiple users share a device, saving new credentials will overwrite the previously stored ones.
Troubleshooting
Last updated