useMfa() hook and rendered the enrollment, recovery-code, and verification screens inside the widget. The JavaScript SDK exposes each operation as its own function (and a matching React hook), so you build the TOTP enrollment, recovery-code, and device-management UI yourself.
Building that UI (QR rendering, code entry, device list, recovery-code screen) is the same in any JavaScript SDK app, so it isn’t repeated here: MFA enrollment & management (Building UI) covers it with full code. This page is the React→JavaScript translation plus the migration-specific gotchas.
What maps to what
Migration-specific behavior
- Register/remove need an elevated token the widget got for you.
registerTotpMfaDevice()anddeleteMfaDevice()require an elevated access token (TokenScope.CredentiallinkandTokenScope.Credentialunlink). The widget minted it automatically; now you obtain it by running a step-up re-verification — see Step-up authentication (Building UI) for the full flow. The same pattern applies tounlinkSocialAccount()and passkey registration. deleteMfaDevice()’smfaAuthTokenis optional. Either pass anmfaAuthTokenor hold an elevatedCredentialunlinktoken from a step-up re-verification — supply one of the two. See Step-up authentication (Building UI).- You show recovery codes now. The widget revealed them automatically after enrollment; fetch with
getMfaRecoveryCodes(), display once, then record acknowledgement withacknowledgeRecoveryCodes(). UseisPendingRecoveryCodesAcknowledgment()to know when that step is still owed.
Errors you now own
See also
- MFA enrollment & management (Building UI) — the full build with QR rendering and device UI
- Step-up authentication — require MFA before a sensitive action
- Post-login user setup — prompt for MFA enrollment when it’s required