Authaz logoAuthaz
DocumentationAPI Reference
  • Get Started

    • Authaz
    • Core Concepts
    • Set up your app
    • Quickstart — cURL
  • Authentication

    • Authentication Settings
    • Signup
    • Invitations
    • Password Authentication
    • Multi-Factor Auth
    • Magic Link
    • OAuth / Social Login
    • Passkey (WebAuthn)
    • SAML SSO
    • Machine-to-Machine (M2M)
    • API Keys
  • Authorization

    • Authorization
    • Resources
    • Policies
    • Roles
    • Access Explorer
  • Tenancy

    • Multi-tenancy
    • Tenancy Customization
  • Brand & Host

    • Branding
    • Custom Domains
    • Communications & Email Templates
  • Operate

    • Users
    • Analytics
    • Audit Logs
    • Application Settings
  • SDK Quickstarts

    • Quickstart — Next.js
    • Quickstart — React SPA
    • Quickstart — Hono
    • Quickstart — .NET (Authaz.Sdk)
  • Recipes

    • Recipes & Cookbook
    • Next.js — first integration
    • Next.js — B2B SaaS (multi-tenant)
    • Hono — first integration
    • Hono — B2B SaaS (multi-tenant)
    • React SPA — first integration
    • React SPA — B2B SaaS (multi-tenant)
    • .NET — first integration
    • .NET — B2B SaaS (multi-tenant)
  • Reference

    • Tokens
    • API Reference
    • Errors & Troubleshooting
  • Documentation

    • How Authaz is Built
  1. Authaz
  2. Docs
  3. Authentication
  4. Multi-Factor Auth

Authentication

Multi-Factor Auth

4 min read·Updated Jun 19, 2026

The Multi-Factor Auth card under Application → Authentication sets the second factor users present after their primary credential. Enabling MFA is the single biggest improvement you can make to account security — phishing-resistant where the second factor is an authenticator, even when passwords get phished.

Use it in your app. Once enforced, Authaz Sign-In adds the second-factor step to every sign-in automatically — your app code doesn't change. The standard sign-in flow (Next.js · React · Hono · cURL) returns the user only after MFA is verified; mfaEnabled shows up on the user object.

curl -X PUT https://your-app.authaz.io/api/v1/applications/{appId}/auth/mfa \
  -H "X-API-Key: $AUTHAZ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "mode": "required",
    "allowedMethods": ["totp"],





Previous
Password Authentication
Next
Magic Link
"primaryMethod": "totp",
"gracePeriodDays": 7,
"rememberDeviceDurationDays": 30,
"maxTrustedDevices": 5,
"canDisable": false
}'

Where it lives#

Dashboard → Application → Authentication → Multi-Factor Auth.

Enforcement modes#

The mode field controls when MFA kicks in:

ModeWhat happens
disabledMFA is off entirely. Users cannot enroll, cannot present a second factor.
optionalUsers can enroll on their own, from their profile page. Sign-in skips MFA for users who haven't enrolled.
requiredEvery user must enroll within the grace period. Sign-in always asks for the second factor (subject to "remember this device").

Most B2B apps want optional for early-stage and required once they've trained users. Switching from optional to required starts the grace-period countdown for every existing user who hasn't enrolled yet.

Methods#

allowedMethods is the menu of factors a user can choose from. primaryMethod is the default that's offered first.

MethodWhat it is
totpTime-based one-time password. Works with any TOTP authenticator app. Default and recommended.
smsSix-digit code texted to the user's phone. Only enable if your audience can't or won't use a TOTP app.
whatsappSame code, delivered over WhatsApp. Useful in regions where WhatsApp is the default communication channel.

TOTP is the strongest of the three — codes are generated locally on the user's device and don't traverse the network, so they can't be SIM-swapped or intercepted.

Trusted devices ("remember me")#

When a user clicks Trust this device after presenting their second factor, Authaz issues a device-bound token that suppresses the MFA prompt on that device for rememberDeviceDurationDays (default: 30).

SettingWhat it controls
rememberDeviceDurationDaysHow long a trusted device skips MFA. 0 disables the feature entirely.
maxTrustedDevicesCap per user. Older devices fall off the list as new ones are added.

The trusted-device token is bound to the browser fingerprint + cookie — copying it to a different device won't bypass MFA.

Grace period#

When mode is required and a user hasn't enrolled yet, they're given gracePeriodDays (default: 7) to set up MFA. During that window they can sign in normally; on each login Authaz Sign-In nudges them with a banner. After the window expires, they cannot sign in until they enroll.

Set gracePeriodDays: 0 for a hard cutover — useful only if you've already announced the change and given users time to prepare.

Self-disable#

canDisable controls whether a user can turn off MFA on their own account from their profile.

ValueMeaning
trueDefault. User can remove MFA themselves (still need to present the current factor to do so).
falseOnce enrolled, users cannot remove MFA. Only an admin can — see "MFA reset" below.

For high-security tenants, canDisable: false paired with mode: required means MFA is permanent.

How TOTP enrollment works#

  1. User signs in with their primary credential (password, magic link, OAuth, etc.).
  2. Authaz Sign-In shows a QR code containing a base-32 secret + an issuer label.
  3. User scans the code with their authenticator app and enters the rolling 6-digit code to confirm.
  4. Authaz issues emergency recovery codes — a list of 8–10 single-use codes the user prints and stores. Each works once if they lose the authenticator.
  5. The user is signed in. On every subsequent login Authaz Sign-In asks for the rolling 6-digit code.

The TOTP secret is encrypted at rest with the application's master key. Authaz never sees the user's authenticator app or device.

Resetting MFA#

When a user loses their phone:

curl -X POST https://your-app.authaz.io/api/v1/users/{userId}/mfa/reset \
  -H "X-API-Key: $AUTHAZ_API_KEY"

This wipes the user's existing TOTP secret and invalidates outstanding recovery codes. On their next sign-in, Authaz Sign-In walks them through enrollment again. An audit-log entry is recorded with the admin who performed the reset.

If the user still has at least one recovery code, they can use it on the MFA prompt instead of asking an admin.

Per-tenant MFA#

When the application's Isolated Auth Stack is on, each tenant can override the application-level MFA policy:

curl -X PUT https://your-app.authaz.io/api/v1/applications/{appId}/tenants/{tenantId}/auth/mfa \
  -H "X-API-Key: $AUTHAZ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "required",
    "gracePeriodDays": 0,
    "canDisable": false
  }'

Useful when one tenant has stricter compliance requirements than the rest. Tenants with no override fall back to the application-level config.

Next steps#

  • Password — the primary factor MFA layers on top of.
  • Passkey — an alternative to MFA for phishing-resistant sign-in (passkeys are themselves multi-factor).
  • Users — see who's enrolled, who's pending, and reset individuals.