Skip to main content
Enrolling in MFA does not automatically verify the user for wallet operations. Once enrolled, subsequent wallet actions will require MFA verification. See the verification guides for how to complete MFA verification.
Enroll users in MFA so they can secure their embedded wallet with an additional authentication factor.

Configuring MFA for custom UIs

The React SDK uses Privy’s default MFA UIs by default. To use custom UIs instead, set the mfa.noPromptOnMfaRequired field to true in the Privy provider:
function MyApp({Component, pageProps}: AppProps) {
  return (
    <>
      <PrivyProvider
        appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID}
        config={{
          mfa: {
            // Defaults to 'false'. Set to 'true' to use custom UIs.
            noPromptOnMfaRequired: true,
          },
          ...insertTheRestOfYourConfig,
        }}
      >
        <Component {...pageProps} />
      </PrivyProvider>
    </>
  );
}
This configures Privy to not show its default UIs for wallet MFA, allowing your app to use custom enrollment and verification flows instead.

Available MFA methods

Users can enroll in three MFA methods:
  • SMS: Users authenticate with a 6-digit MFA code sent to their phone number
  • TOTP: Users authenticate with a 6-digit MFA code from an authentication app, like Authy or Google Authenticator
  • Passkey: Users verify with a previously registered passkey, generally through biometric authentication on their device

Enrollment interfaces

To enroll users in MFA, use the useMfaEnrollment hook from Privy:
import {useMfaEnrollment} from '@privy-io/react-auth';

const {
  initEnrollmentWithSms,
  submitEnrollmentWithSms,
  initEnrollmentWithTotp,
  submitEnrollmentWithTotp,
  initEnrollmentWithPasskey,
  submitEnrollmentWithPasskey,
} = useMfaEnrollment();

Next steps