Two-Step Verification (MFA)
Two-step verification asks for a 6-digit code from an authenticator app after the user signs in. Any app that supports time-based codes (TOTP) works.
When users are asked
Section titled “When users are asked”| User | What happens |
|---|---|
| Has set up an authenticator app | Asked for a code on every sign-in, in every application |
| Has not, and the application requires it | Sets up an app during sign-in, then continues |
| Has not, and the application doesn’t | Signs in as before |
The application setting only decides whether users must set up an app. With it off, users who already have one set up are still asked for a code.
This applies to every way of signing in: password, emailed code, social and enterprise connections. A passkey sign-in counts as two-step verification and is not asked for a code.
A session created with two-step verification is reused without asking again. A session created without it asks for the code before it is reused.
Require it for an application
Section titled “Require it for an application”In the dashboard, open the application and turn on Authentication policy >
Require two-step verification. With the Management API, set requireMfa to
true on PATCH /api/v1/applications/{id}.
Setting up
Section titled “Setting up”The user scans a QR code with their authenticator app and enters the code it shows. They then see 10 recovery codes, once. Each recovery code signs them in once when they can’t use their app.
Signing in
Section titled “Signing in”The hosted login shows a code page after the first step. Use a recovery code switches to a recovery code field.
After a recovery code, the page offers to set up a new authenticator app. The user scans a new QR code and enters its code. The new app replaces the old one, and they see 10 new recovery codes, once. The old app and the old recovery codes stop working. Skip keeps the old app.
Each code from the app works once. Repeated wrong codes end the sign-in, and the user starts signing in again.
In the tokens
Section titled “In the tokens”When the user completed two-step verification, the ID token and the access token include:
{ "amr": ["mfa"] }Refreshed tokens keep it. Check it on your API before sensitive actions.
Reset a user’s two-step verification
Section titled “Reset a user’s two-step verification”For a user who lost their phone and their recovery codes, open the user in the dashboard and choose Account access > Two-step verification > Reset. With the Management API:
DELETE https://<tenant-domain>/api/v1/users/{userId}/mfaAuthorization: Bearer <management token>A reset removes the user’s authenticator app and recovery codes. They then sign in without a code, unless the application requires two-step verification, in which case they set up a new app at their next sign-in.
GET /api/v1/users/{userId} returns mfaEnrolled: true while it is set up.
In-app sign-in
Section titled “In-app sign-in”With in-app sign-in, a user who has set it
up gets 403 with mfa_required: true after the first step. Send otp with
the code from their app, or recovery_code, with the auth_session. A user who
must first set up an app gets redirect_to_web.