Passkeys
A passkey is a WebAuthn credential stored on the user’s device or password manager. It cannot be phished and needs no password. Every passkey ceremony requires user verification (biometrics or PIN) and a discoverable credential, so a passkey sign-in needs no email address.
Passkeys are opt-in per project and off by default: until you enable them, passkey calls answer 404 passkeys_disabled. They are new, so check that your project has them before you depend on them.
Enable
Section titled “Enable”Set the relying party for your project with PATCH /v1/projects/{ref}/config/auth:
{ "passkeys": { "enabled": true, "rp_id": "example.com", "rp_name": "Example", "origins": ["https://app.example.com"] } }| Field | Default |
|---|---|
rp_id |
the host of the project’s site_url |
origins |
site_url plus trusted origins; only https (or http://localhost) origins whose host is rp_id or a subdomain of it are kept |
rp_name |
optional display name shown by the browser |
If no valid origin remains, calls answer 500 passkeys_misconfigured. A passkey is bound to rp_id: changing it later makes existing passkeys unusable.
Register a passkey
Section titled “Register a passkey”The user must be signed in. Registration asks for fresh authentication: pass the current password, or call it within 5 minutes of signing in (otherwise reauth_required). If the account already has a second factor, the session must be aal2 (mfa_aal2_required). Anonymous users cannot register one, and an account can have up to 20.
if (base.auth.passkeys.isSupported()) { const { data, error } = await base.auth.passkeys.register({ friendlyName: "MacBook" }) // data.passkey: { id, friendly_name, transports, device_type, backed_up, created_at, last_used_at }}
const { data: list } = await base.auth.passkeys.list()await base.auth.passkeys.remove({ id }) // needs an aal2 session when the account has a second factorSign in
Section titled “Sign in”const { data, error } = await base.auth.passkeys.signIn() // the browser shows the passkey pickerThe session is aal2 and its amr contains passkey. A passkey is already two factors (possession and biometrics or PIN), so the MFA step does not apply. The result has the same shape as signInWithPassword.
As a second factor
Section titled “As a second factor”When MFA and passkeys are both enabled, a registered passkey counts as a second factor for every other sign-in method. The first step answers mfaRequired with a webauthn entry in factors:
const r = await base.auth.signInWithPassword({ email, password })if (r.data.mfaRequired) { const hasPasskey = r.data.factors?.some((f) => f.factor_type === "webauthn") if (hasPasskey) await base.auth.passkeys.challenge({ ticket: r.data.ticket! }) // otherwise: base.auth.mfa.challenge({ ticket, code })}
// raise a session that is already signed in from aal1 to aal2await base.auth.passkeys.stepUp()If MFA is off for the project, a passkey is just one more way to sign in. Clients that only understand totp factors must be updated before you enable passkeys together with MFA.
Errors
Section titled “Errors”| Code | When |
|---|---|
passkeys_disabled (404) |
not enabled for the project |
passkey_unsupported |
this runtime has no WebAuthn (navigator.credentials) |
passkey_cancelled |
the user dismissed the prompt or it timed out |
passkey_already_registered (409) |
this authenticator is already registered |
reauth_required, mfa_aal2_required |
registration or removal needs fresher or stronger authentication |
passkey_clone_suspected (401) |
the signature counter went backwards; the sign-in is refused |