Skip to main content
When both enrolling in and completing MFA, Privy sends a 6-digit code to the user’s selected MFA method, that the user must submit to Privy in order to verify their identity. When submitting this MFA code, Privy may respond with an error if:
  • The code is incorrect
  • The user has reached the maximum number of attempts for this MFA flow
  • The MFA flow has timed out
If the user enters an incorrect code (e.g. by mistyping), they are allowed to retry code submission up to a maximum of four attempts.

Error helper functions

Privy provides helper functions to parse errors raised by MFA code submission methods. Each of these functions accepts the raw error raised as a parameter, and returns a Boolean indicating if the error meets a certain condition.

errorIndicatesMfaVerificationFailed

Indicates the user entered an incorrect MFA code. Allow the user to re-enter the code and call submit again.

errorIndicatesMfaMaxAttempts

Indicates the user has reached the maximum number of attempts for this MFA flow. A new MFA code must be requested via init.

errorIndicatesMfaTimeout

Indicates that the current MFA code has expired. A new MFA code must be requested via init.

Example usage

Handling errors during MFA code submission