Interactive passkey login
A user chooses passwordless authentication from a sign-in screen.
Better Auth · Module
signIn.passkey starts a Better Auth passkey sign-in flow through WebAuthn. It supports browser autofill, optional WebAuthn extensions, and returning WebAuthn response details.
authClient.signIn.passkey starts a WebAuthn passkey sign-in flow. Setting autoFill to true lets the browser preload passkeys for Conditional UI; optional extensions can be supplied, and the response can include WebAuthn details when requested.
authClient.signIn.passkey({ autoFill?, extensions?, returnWebAuthnResponse? })| Name | Type | Description |
|---|---|---|
autoFill | boolean, optional | Enables browser autofill, also known as Conditional UI. |
extensions | WebAuthn extensions, optional | Optional WebAuthn extensions, including PRF, credProps, or largeBlob. |
returnWebAuthnResponse | boolean, optional | Requests the WebAuthn response and extension results in the result. |
The sign-in result, exposed as data and error by the client example; when requested, it can include the WebAuthn response and extension results.
signIn.passkey to initiate authentication with a registered passkey./sign-in/passkey.autoFill to true when the browser should suggest passkeys through Conditional UI.returnWebAuthnResponse when the caller needs the WebAuthn response and extension results.autoFill to true.const { data, error } = await authClient.signIn.passkey({
autoFill: true,
});
if (error) {
console.error(error);
} else {
console.log(data);
}Starts passkey sign-in and enables browser autofill, also known as Conditional UI.
A user chooses passwordless authentication from a sign-in screen.
A sign-in component should offer discoverable credentials as it loads.
An application needs WebAuthn extension output for a specialized flow.
Use authClient.signIn.passkey to begin passkey authentication. It prompts the user to authenticate with a passkey and maps to POST /sign-in/passkey.
Follow-up: How can the browser offer passkeys without an explicit button click? Call the method on component mount with autoFill: true to preload them for Conditional UI.
autoFill option do?Pass autoFill: true to enable browser autofill, also called Conditional UI. This is useful when passkeys should be offered as the component loads.
Follow-up: What additional WebAuthn data can be requested? Supply optional extensions, such as credProps, PRF, or largeBlob.
The client method accepts optional WebAuthn extensions and can return the WebAuthn response and extension results when returnWebAuthnResponse is enabled. The documented examples include extensions such as credProps, PRF, and largeBlob.
Follow-up: What server-side equivalent is documented? Use auth.api.signInPasskey with a body containing the same sign-in options.
Passkey pluginauthClient.signIn.passkeyauth.api.signInPasskeyWebAuthnConditional UI