useLocalCredentials()
The useLocalCredentials()
hook enables you to store a user's password credentials on their device and subsequently use biometrics for sign-in. This enhances the user experience by allowing users to sign in using Face ID or another biometric authentication method during future sign-ins.
- Name
hasCredentials
- Type
boolean
- Description
Indicates if there are any credentials stored on the device.
- Name
userOwnsCredentials
- Type
boolean
- Description
Indicates if the stored credentials belong to the signed in user. When there is no signed-in user, the value will always be
false
.
- Name
biometricType
- Type
'face-recognition' | 'fingerprint' | null
- Description
Indicates the supported enrolled biometric authenticator type.
- Name
setCredentials()
- Type
(params: LocalCredentials) => Promise<void>
- Description
Stores the provided credentials on the device if the device has enrolled biometrics. The end user needs to have a passcode set in order for the credentials to be stored, and those credentials will be removed if the passcode gets removed. The promise will reject if the value cannot be stored on the device.
- Name
clearCredentials()
- Type
() => Promise<void>
- Description
Removes the stored credentials from the device. The promise will reject if the value cannot be deleted from the device.
- Name
authenticate()
- Type
() => Promise<SignInResource>
- Description
Attempts to read the stored credentials and creates a sign-in attempt with the password strategy.The promise will resolve to a
SignInResource
if the stored credentials were accessed. Otherwise, the promise will reject.
- Name
identifier
- Type
string?
- Description
The identifier of the credentials to be stored on the device. It can be a username, email, phone number, etc.
- Name
password
- Type
string
- Description
The password for the identifier to be stored on the device. If an identifier already exists on the device, passing only
password
would update the password for the stored identifier.
How to use the useLocalCredentials()
hook
To learn how to use the useLocalCredentials()
hook, see the dedicated guide.
Feedback
Last updated on