- Enable and configure your MFA policy for your tenant
- Use
api.multifactor.enable()in a Post-Login Action
/token endpoint with a mfa_required error. You can use the error in the Auth0 MFA API to challenge and verify a factor to obtain the requested Auth0 access, ID, and refresh tokens.
Custom Token Exchange Early Access does not support
api.authentication.challengeWith() or api.authentication.enrollWith(). If you use those methods with your Post-Login Action, the transaction will fail with a non-recoverable error. Make sure you don’t use those methods when event.transaction.protocol==oauth2-token-exchange depending on the subject_token_type value.api.multifactor.enable() and MFA policies are also not supported.
To learn more about how to use the MFA grant, read Authenticate Using the Resource Owner Password Flow with MFA, as Custom Token Exchange follows the same model. You can also check out a detailed example in Use case: Perform MFA during Custom Token Exchange.