Skip to main content
Unenrolling an MFA method requires MFA verification.
Allow users to remove previously enrolled MFA methods from their account.
Privy allows users to delete MFA methods via the unenrollWithSms, unenrollWithTotp, and unenrollWithPasskey methods returned from the useMfaEnrollment hook:
import {useMfaEnrollment} from '@privy-io/react-auth';

const {unenrollWithSms, unenrollWithTotp, unenrollWithPasskey} = useMfaEnrollment();

Unenrolling SMS

To remove SMS as an MFA method:
await unenrollWithSms();

Unenrolling TOTP

To remove TOTP as an MFA method:
await unenrollWithTotp();

Unenrolling passkeys

To remove passkeys as an MFA method:
await unenrollWithPasskey();

Complete example

Example unenrolling SMS/TOTP/passkey
import {useMfaEnrollment} from '@privy-io/react-auth';

export default function MfaUnenrollment() {
  const {unenrollWithSms, unenrollWithTotp, unenrollWithPasskey} = useMfaEnrollment();

  return (
    <div>
      <button onClick={unenrollWithSms}>Unenroll SMS</button>
      <button onClick={unenrollWithTotp}>Unenroll TOTP</button>
      <button onClick={unenrollWithPasskey}>Unenroll passkey</button>
    </div>
  );
}