SECURITY_SETUP_REQUIRED challenge instead of tokens:
confirming a sign-up,
an email-verified password login,
changing a temporary password,
and finishing a password reset.
sessionToken from the challenge is what you send on
every call below. None of them take a bearer token, because there isn’t one yet.
The flow
Pick one path, then finish. Three calls for a passkey, three for 2FA.Passkey path (recommended)
- Set up a passkey (start): send the
sessionToken. You get backpublicKeycreation options. - Create the passkey on the device. The start response is not the passkey: it is the set of
options the device needs to make one. On the web, pass them to
navigator.credentials.create()from the WebAuthn API; on iOS and Android, use the platform credential API. The user needs a device that can create a passkey: a computer or phone with Face ID, Touch ID or a screen lock, a phone used via QR code, or a hardware security key. The OS prompts the user and returns the attestation. Nothing is sent to us during this step, and we can’t produce the attestation for you, so a script alone can’t complete passkey setup. For testing, Chrome DevTools has a virtual authenticator. - Set up a passkey (finish): send the
sessionTokenand the attestation. The passkey is now stored.
2FA path
- Set up 2FA (start): send the
sessionToken. You get back asecretand anotpauth://qrUri. Render the QR code so the user can scan it into their authenticator app. - Set up 2FA (confirm): send the
sessionTokenand the first 6-digit code the app shows. 2FA is now on.
Finish and get tokens
Whichever path you took, call Finish security setup with thesessionToken. It returns the full set of
tokens and the user is signed in.
The
sessionToken is short-lived. If it expires you get 410 SESSION_EXPIRED. Send the
user back through the flow that issued it (log in again, for example) to get a fresh one.