mfa client export provides a singleton API for handling multi-factor authentication operations from the client side. All methods are thin wrappers around fetch calls to server-side MFA routes where the actual business logic executes.
Import
Methods
getAuthenticators
List enrolled MFA authenticators for the current MFA session.string
required
Encrypted MFA token received from
MfaRequiredErrorAuthenticator[]
Array of available authenticators
MfaTokenExpiredError- Token TTL exceededMfaTokenInvalidError- Token tampered or malformedMfaGetAuthenticatorsError- Auth0 API error
challenge
Initiate an MFA challenge (e.g., send SMS code).string
required
Encrypted MFA token
string
required
Type of challenge (e.g., “oob” for SMS/email, “otp” for authenticator apps)
string
Specific authenticator to use (required for some challenge types)
ChallengeResponse
Challenge response object
MfaTokenExpiredError- Token TTL exceededMfaTokenInvalidError- Token tampered or malformedMfaChallengeError- Auth0 API error
verify
Verify MFA code and complete authentication.VerifyMfaOptions is a union type that accepts different verification methods:
- OTP (TOTP)
- OOB (SMS/Email)
- Recovery Code
MfaVerifyResponse
Token response after successful verification
MfaTokenExpiredError- Token TTL exceededMfaTokenInvalidError- Token tampered or malformedMfaRequiredError- Additional MFA factor required (chained MFA)MfaVerifyError- Auth0 API error (wrong code, rate limit, etc.)
If Auth0 returns
mfa_required, this indicates chained MFA where multiple factors are required sequentially. The error will contain a new mfa_token for the next factor.enroll
Enroll a new MFA authenticator.string
required
Encrypted MFA token
string[]
required
Array of authenticator types to enroll (e.g., [“otp”], [“oob”], [“email”])
string
Phone number for SMS enrollment (required for oob type)
string
Email address for email enrollment (required for email type)
EnrollmentResponse
Enrollment response with authenticator details
MfaTokenExpiredError- Token TTL exceededMfaTokenInvalidError- Token tampered or malformedMfaEnrollmentError- Auth0 API error
Usage Pattern
The typical MFA flow using the client API:1
Catch MfaRequiredError
When authentication fails with MFA required, extract the
mfaToken from the error.2
List available authenticators
3
Challenge (if needed)
For SMS/email, initiate a challenge:
4
Verify
Collect the code from the user and verify:
See Also
- MFA Guide - Complete MFA implementation guide
- MFA Errors - MFA error reference
- Server MFA Handling - Server-side MFA handling