A password, an emailed code or a social login proves one thing about the person signing in. Two-step verification adds a second proof: something only their phone has.
AuthAction now supports two-step verification with authenticator apps. After the first step of signing in, the user enters a 6-digit code from an app on their phone. Any app that supports time-based codes (TOTP) works.
Who gets asked for a code
It depends on whether the user has set up an authenticator app, and on whether the application they are signing in to requires one.
| 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, a user who already has one set up is still asked for a code.
It applies to every way of signing in: password, emailed code, social and enterprise connections. A passkey sign-in already counts as two-step verification, so it is not asked for a code. If you are deciding between the two, Passkeys vs MFA explains the difference.
Sessions follow the same rule. 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.
Setting up an app
When a user sets up two-step verification, the hosted login shows a QR code. They scan it with their authenticator app and type the code the app shows.
They then see 10 recovery codes, once. Each recovery code signs them in once when they can't use their app, so they should keep them somewhere safe.
Signing in
After the first step, the hosted login shows a code page. The user types the current code from their app. Use a recovery code switches to a recovery code field.
Each code from the app works once, and repeated wrong codes end the sign-in.
Checking it in your API
When the user completed two-step verification, both the ID token and the access token include:
{ "amr": ["mfa"] }
Refreshed tokens keep it. Before a sensitive action, such as changing a payout
account or deleting data, check for mfa in amr on your API.
When someone loses their phone
A user who lost both their phone and their recovery codes needs an admin. Open the user in the dashboard and choose Account access > Two-step verification > Reset, or call the Management API:
DELETE https://<tenant-domain>/api/v1/users/{userId}/mfa
Authorization: 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.
In your own sign-in screens
Two-step verification also works with
in-app sign-in. A user who has
set up an app gets 403 with mfa_required: true after the first step. Your
app then sends otp with the code from their app, or recovery_code, along
with the auth_session. A user who must first set up an app gets
redirect_to_web, and finishes the setup on the hosted login.
Trying it with AuthAction
Two-step verification is free and unlimited on AuthAction's free plan, like
every other feature. To require it for an application, open the application in the dashboard and
turn on Authentication policy > Require two-step verification. With the
Management API, set requireMfa to true on
PATCH /api/v1/applications/{id}.
The two-step verification docs cover every case in detail.