Biometric login
Use this integration for allowing your user to login to the app using biometric login (Touch / Face ID).
On this page
Introduction
This module enables users to save their credentials on their device and unlock it using biometric authentication (such as Touch ID or Face ID).
Where to find: startiapp.Biometrics
Methods
scan
scan(title?: string, reason?: string): Promise<boolean>
Start scanning for biometrics.
The title
and reason
are displayed to the user on some devices. Default values are provided but can be overridden.
getAuthenticationType
getAuthenticationType(): Promise<BiometricsAuthenticationType>
Get the type of biometrics used. Returns: "None"
, "Fingerprint"
or "Face"
.
setSecuredContent
setSecuredContent(content: string | object): void
Set the content to be secured.
‘content’ refers to items that can be secured on the device, such as passwords or full objects.
getSecuredContent
getSecuredContent(title?: string, reason?: string): Promise<object>
Get the secured content if the user is successfully recognized.
The title
and reason
are displayed to the user on some devices.
It’s recommended to always provide descriptive text, even though it may not be displayed on all devices.
hasSecuredContent(): Promise<boolean>
Check if there is any secured content on the device.
removeSecuredContent
removeSecuredContent(): Promise<void>
Remove any secured content.
setUsernameAndPassword
setUsernameAndPassword(username: string, password: string): Promise<void>
Store username and password secured by biometrics.
getUsernameAndPassword
getUsernameAndPassword(title?: string, reason?: string): Promise<{ username: string, password: string } | null>
Retrieve stored username and password if biometric authentication succeeds.
hasUsernameAndPassword
hasUsernameAndPassword(): Promise<boolean>
Check if there are stored credentials.
removeUsernameAndPassword
removeUsernameAndPassword(): Promise<void>
Remove stored credentials.
startSaveUsernameAndPassword
startSaveUsernameAndPassword(request: SaveUsernameAndPasswordConfiguration): Promise<void>
Start the process of saving credentials using biometrics. Must be followed by endSaveUsernameAndPassword
after successful login.
endSaveUsernameAndPassword
endSaveUsernameAndPassword(): Promise<void>
Complete the process of saving credentials using biometrics.
checkAccess
checkAccess(): Promise<PermissionStatus>
Check if biometric access is granted.
Types
SaveUsernameAndPasswordConfiguration
type SaveUsernameAndPasswordConfiguration = {
usernameInputFieldSelector: string;
passwordInputFieldSelector: string;
submitButtonSelector: string;
title: string;
reason: string;
language?: "da" | "en";
}
Configuration for saving credentials using biometrics.
BiometricsAuthenticationType
type BiometricsAuthenticationType = "None" | "Face" | "Fingerprint"
Types of biometric authentication available.
PermissionStatus
type PermissionStatus = {
granted: boolean;
}
Status of biometric permission.
Examples
Basic Usage
// Start saving credentials
await startiapp.Biometrics.startSaveUsernameAndPassword({
usernameInputFieldSelector: "#username",
passwordInputFieldSelector: "#password",
submitButtonSelector: "#submit",
title: "Save Login",
reason: "For quick access next time"
});
// After successful login
await startiapp.Biometrics.endSaveUsernameAndPassword();