Step up for sensitive actions
Ask a signed-in user for a stronger sign-in, such as a one-time code, before a payment or an admin change, and let the app and API see that they gave it.
Dashboard and APIOpenID Connect Core 1.0, RFC 9470
Users sign in to your app with a light sign-in for everyday use. When they reach a sensitive action, such as approving a payment, changing an email address or deleting an account, the app asks the realm for a stronger level by name. The realm takes them through a stronger sign-in, such as a password plus a one-time code, and the new tokens say which level they reached.
The level is an acr value: a name you choose, such as urn:example:acr:mfa. You tell the realm which
sign-in chain earns each name (see Sign-in chains).
Before you start:
- Who can do it: a realm administrator, in a group that holds
RealmOwner(Delegated administration). - Where: step 1 in the dashboard, Authentication → Settings, or the API; steps 2 and 3 through the API
(Call the API shows how to get
$CVYUH_SESSION). - First: this guide is for a realm whose everyday chain is lighter than the one it was born with (a passkey, or a
password then an authenticator code,
universalLogin), such as a password alone (nativeStoreChain). Users need an authenticator app set up to pass the stronger chain.
Set up the stronger level
Section titled “Set up the stronger level”-
Make sure the second factor is offered. A realm is born with
totpin itsauthenticatorsand atotpmodule instance. If yours lacks it, add it in Authentication → Settings to the recognized modules. In the API, read the list withGET https://foobar.cvyuh.com/api/v0/am/objects/v1/authSettings/authSettings, then send it back withtotpadded:Terminal window curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/authSettings/authSettings \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "authenticators": ["…existing modules", "totp"] }'The list you send replaces the realm’s whole list: a module you leave out can no longer run.
-
Create the stronger chain: a password, then a one-time code from an authenticator app.
Terminal window curl 'https://foobar.cvyuh.com/api/v0/am/objects/v1/authChain?id=mfa' \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "chain": [{ "module": "nativeStore", "flag": "REQUIRED" },{ "module": "totp", "flag": "REQUIRED" }] }' -
Name the levels, and the methods each module adds. The everyday chain earns
pwd, the new chain earnsmfa:Terminal window curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Settings/oauth2Settings \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{"acrValues": { "urn:example:acr:pwd": "<your everyday chain>","urn:example:acr:mfa": "mfa" },"amrValues": { "nativeStore": "pwd", "totp": "otp" }}' -
Tell app developers the level’s name. For the sensitive action, the app sends a normal sign-in request with
acr_values=urn:example:acr:mfa.
What users and apps see
Section titled “What users and apps see”The user clicks Approve payment. The realm takes them through the stronger chain (their password, then their authenticator code), and they’re back in the app with the payment going through. Their session continues: it is the same session, now stronger, and one sign-out still ends everything from before and after the step-up.
The new ID token and access token carry acr: urn:example:acr:mfa, and amr lists the methods used (for example
pwd and otp), if you map them.
At an API behind the gateway, a policy can require a stronger level. The gateway then answers 401 with
error="insufficient_user_authentication" and the acr_values or max_age it needs, and the app starts a step-up
with exactly that.
Check it worked
Section titled “Check it worked”Send a sign-in with acr_values=urn:example:acr:mfa as a signed-in test user. You should be asked for the code, and
the ID token’s acr should be urn:example:acr:mfa.
The step-up is on the user’s trail as a SESSION_UPGRADED record, then a LOGIN record whose steps show the
password and the code. A wrong code is a LOGIN_FAILED record, and counts toward
Lockout. Find them in Audit → Authentication in the dashboard.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
The user signs in as usual and acr is the everyday value | The app asked for a value not in acrValues, which is ignored | Ask for the exact name; have the app check the acr it gets back |
| The user is asked for a code they never set up | They have no authenticator app yet | They set one up when the chain asks; see Sign-in methods |
| Saving the chain is refused | A module it names doesn’t exist in the realm | Check the realm has a totp module instance (step 1) |
login_required | The request carried prompt=none | Drop prompt=none for a step-up |
Undo it
Section titled “Undo it”Remove the level by sending its key as null in acrValues:
{ "acrValues": { "urn:example:acr:mfa": null } }. Apps that ask for it then sign users in as usual.
Related
Section titled “Related”- Step-up and re-authentication:
acr,amrand the challenges APIs send. - Sign-in chains: how a chain combines methods.
- Sessions: how a session is made stronger in place.
- Ask users to sign in again: a newer sign-in rather than a stronger one.
- Requests and refusals: where the gateway’s step-up challenge comes from.