How-to Guides
Biometric Login
Use Face ID and fingerprint to save and retrieve user credentials securely
Biometric Login
Use biometrics (Face ID / fingerprint) to let users log in without typing their credentials each time. The SDK can save, retrieve, and manage username/password pairs secured by biometric authentication.
Prerequisites
- The starti.app SDK is installed and initialized
- The device supports biometric authentication (Face ID or fingerprint)
Option A: Manual credential flow
Save and retrieve credentials directly with biometric protection.
Save credentials
await startiapp.Biometrics.setUsernameAndPassword("user@example.com", "s3cret");Retrieve credentials
When retrieving, the user is prompted for biometric verification:
const credentials = await startiapp.Biometrics.getUsernameAndPassword(
"Authenticate", // title shown in the biometric prompt
"Log in to your account", // reason text
);
if (credentials) {
console.log(credentials.username, credentials.password);
// Use credentials to log in
} else {
console.log("Biometric authentication failed or no saved credentials");
}Check if credentials exist
const hasCreds = await startiapp.Biometrics.hasUsernameAndPassword();Remove saved credentials
await startiapp.Biometrics.removeUsernameAndPassword();Option B: Form-based auto-capture flow
Automatically capture credentials from a login form and prompt the user to save them.
1. Before login, attach the middleware to your form
await startiapp.Biometrics.startSaveUsernameAndPassword({
usernameInputFieldSelector: "#email",
passwordInputFieldSelector: "#password",
submitButtonSelector: "#login-button",
title: "Authenticate",
reason: "Save your login for next time",
language: "en", // or "da"
});2. After successful login, save the captured credentials
await startiapp.Biometrics.endSaveUsernameAndPassword();The SDK intercepts the form submission, captures the entered credentials, asks the user if they want to use biometrics next time, and saves the credentials if they agree.
Checking biometric availability
const type = await startiapp.Biometrics.getAuthenticationType();
// Returns: "face" | "fingerprint" | "none"