Prompt
How do I add step-up authentication for risky sign-in or checkout actions?
Latest observation
Oct 28, 2026
OpenAI APIWeb search: off
Step-up authentication means you ask for additional verification only when an action looks risky instead of forcing stronger auth every time.
Common places to use it
- Risky sign-in
- New device
- New location / impossible travel
- Suspicious IP / VPN / Tor
- Large password-reset activity
- Sensitive checkout or account actions
- Large purchase
- New shipping address
- New payment method
- Changing email, phone, MFA settings
- Transferring funds / redeeming credits
Typical step-up methods
Use one or more of:
- TOTP authenticator app
- WebAuthn / Passkeys — best option if available
- Push approval in a mobile app
- Email OTP — okay for low risk, weaker than the above
- SMS OTP — better than nothing, but less secure than app/passkey
A practical implementation pattern
1) Define risk rules
Create a risk score or rule set:
risk = low | medium | high- If high, require step-up
- If medium, maybe require step-up only for especially sensitive actions
Example triggers:
- device changed
- geo changed
- IP reputation bad
- checkout amount > threshold
- shipping country changed
- account age < N days
- recent password reset
2) Track current authentication level
After the user logs in, store an auth assurance level for the session, for example:
aal1= password onlyaal2= password + MFAaal3= phishing-resistant MFA / passkey
Then for each sensitive action, compare:
- required level for the action
- current session level
- if current < required, require step-up
3) Challenge only when needed
Flow:
- User signs in normally
- User starts risky action
- Backend checks risk and session age
- If step-up needed, return a challenge
- User completes MFA/passkey
- Mark the session as step-up verified for a limited time
- Resume the action
4) Re-authenticate, don’t just trust the existing session
For sensitive actions, require:
- recent password entry or
- recent MFA confirmation
Example policy:
- checkout over $500 => step-up if last MFA was more than 10 minutes ago
- adding new bank account => always step-up
- changing password/email => step-up and invalidate other sessions
5) Make the step-up token short-lived
After successful step-up:
- issue a short-lived “verified” state
- bind it to the session/device
- expire quickly, e.g. 5–15 minutes
- require re-step-up for another high-risk action
Example API design
You can implement an endpoint like:
POST /actions/checkout
Response when step-up is required:
{
"status": "step_up_required",
"challenge_id": "abc123",
"methods": ["webauthn", "totp"]
}
Then:
- Client starts MFA flow
- Client sends proof to:
POST /auth/step-up/verify
- Server validates challenge and upgrades session
- Client retries original action
Good security practices
- Prefer WebAuthn/passkeys over OTP when possible
- Tie the challenge to:
- action type
- amount
- user ID
- session ID
- expiry time
- Prevent replay by using one-time challenges
- Log every step-up request and result
- Rate-limit failed attempts
- If step-up fails repeatedly, consider locking or cooling down the account
- For checkout, display a clear reason: “We need to verify it’s really you because this purchase is unusual.”
UX tips
- Tell users why they are being challenged
- Keep the flow fast and mobile-friendly
- Remember trusted devices only after strong verification
- Avoid asking for step-up too often; use risk-based triggers to minimize friction
Recommended baseline
If you’re starting from scratch:
- Use password + WebAuthn/passkeys
- Add risk rules for unusual sign-in and high-value actions
- Require step-up for sensitive actions when risk is elevated
- Keep step-up sessions short-lived
- Prefer phishing-resistant methods whenever possible
If you want, I can also provide:
- a sample backend middleware implementation
- a database schema
- or a risk-based policy example for login/checkout flows.