Skip to main content
The 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 MfaRequiredError
Authenticator[]
Array of available authenticators
Example:
Throws:
  • MfaTokenExpiredError - Token TTL exceeded
  • MfaTokenInvalidError - Token tampered or malformed
  • MfaGetAuthenticatorsError - 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
Example:
Throws:
  • MfaTokenExpiredError - Token TTL exceeded
  • MfaTokenInvalidError - Token tampered or malformed
  • MfaChallengeError - Auth0 API error

verify

Verify MFA code and complete authentication.
The VerifyMfaOptions is a union type that accepts different verification methods:
For authenticator app codes (6-digit TOTP codes).
MfaVerifyResponse
Token response after successful verification
Example:
Throws:
  • MfaTokenExpiredError - Token TTL exceeded
  • MfaTokenInvalidError - Token tampered or malformed
  • MfaRequiredError - 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
Example:
Throws:
  • MfaTokenExpiredError - Token TTL exceeded
  • MfaTokenInvalidError - Token tampered or malformed
  • MfaEnrollmentError - 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