Dashboard Setup
MFA enrollment requires users to register a TOTP device or Passkey. Configure it in the dashboard before implementing in your application. See End-User MFA - Enrollment for dashboard setup instructions.Your UI SDK Implementation
- TOTP
- Passkey
- Trigger gating: Check
userWithMissingInfo?.scopeforrequiresAdditionalAuth. - Detect MFA: Use
useSyncMfaFlowto 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
qrcodeis 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, MFA enrollment 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
Programmatic MFA Modal Controls
Dynamic SDKs provide granular control over individual MFA modal screens. These methods allow you to programmatically show and hide specific MFA screens in your application.Available Modal Controls
For React applications, use theuseDynamicModals hook to control MFA modal visibility: