Dashboard Setup
- Go to the Security page.
- In the Account MFA section, enable your desired methods (TOTP and/or Passkeys).
- (Optional) Toggle “Require at onboarding” to force MFA setup during signup.
- (Optional) Toggle “Session-based MFA” to require MFA for every new session.
Your UI SDK Implementation
- TOTP
- Passkey
- Trigger gating: Check
userWithMissingInfo?.scope
forrequiresAdditionalAuth
. - Detect MFA: Use
useSyncMfaFlow
to know when to prompt. - Add device: Call
addDevice()
→ show QR fromuri
(installqrcode
). - Verify:
authenticateDevice({ code })
→ fetch and show recovery codes →completeAcknowledgement()
. - Refresh: Call
getUserDevices()
after verification.
- Recovery codes are single-use. Regenerate with
getRecoveryCodes(true)
if needed.
- Error: “401 Unauthorized” when adding a second TOTP device — only one device is supported; delete the existing device first.
- QR code not displaying — ensure
qrcode
is installed:npm install qrcode @types/qrcode
. - Recovery codes not working — each code is single-use; generate new codes if exhausted.
Dynamic UI Implementation
With the Dynamic UI, account-based MFA prompts appear automatically during onboarding/login when additional authentication is required. To explicitly trigger in your app, useuseSyncMfaFlow
to detect the requirement and usePromptMfaAuth
to open the UI.
Note: The Dynamic UI is method-agnostic. It automatically prompts with whichever MFA method(s) you have enabled (TOTP and/or Passkeys), so separate TOTP/Passkey tabs are not required here.
- useSyncMfaFlow hook to detect the requirement and open the Dynamic UI
- usePromptMfaAuth hook to prompt the user to authenticate with MFA