Four flows end with a 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.
The account exists, but the user has no tokens yet. They need a second factor first: a passkey (recommended) or 2FA. The 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.
  1. Set up a passkey (start): send the sessionToken. You get back publicKey creation options.
  2. 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.
  3. Set up a passkey (finish): send the sessionToken and the attestation. The passkey is now stored.

2FA path

  1. Set up 2FA (start): send the sessionToken. You get back a secret and an otpauth:// qrUri. Render the QR code so the user can scan it into their authenticator app.
  2. Set up 2FA (confirm): send the sessionToken and 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 the sessionToken. It returns the full set of tokens and the user is signed in.
Calling finish before a passkey or 2FA is set up returns 403 SECURITY_SETUP_NOT_COMPLETE.
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.