Skip to main content
Multi-Factor Authentication (MFA) adds an additional security layer by requiring users to provide a second form of verification. Supabase supports TOTP (Time-based One-Time Password) using authenticator apps.

Overview

Supabase MFA uses the TOTP standard, compatible with popular authenticator apps:
  • Google Authenticator
  • Microsoft Authenticator
  • Authy
  • 1Password
  • Any TOTP-compatible app

How MFA Works

1

User Signs In

User authenticates with email/password or OAuth
2

Enroll MFA

User scans QR code or enters secret key into authenticator app
3

Verify Code

User enters 6-digit code from authenticator app
4

AAL2 Session

User now has an AAL2 (Authenticator Assurance Level 2) session

Assurance Levels

Supabase uses Authenticator Assurance Levels (AAL) to determine session security:
  • AAL1: Single-factor authentication (email/password or OAuth)
  • AAL2: Multi-factor authentication (MFA verified)

Enable MFA

Enable MFA in your Supabase dashboard:
  1. Navigate to Authentication > Settings
  2. Scroll to “Multi-Factor Authentication”
  3. Toggle “Enable Multi-Factor Authentication”

Enroll MFA

Step 1: Initiate Enrollment

Step 2: Display QR Code

React Component

Step 3: Verify Enrollment

Complete Flutter MFA Example

Flutter Enrollment

Challenge and Verify

After enrollment, users must verify their MFA code at each login:

List Enrolled Factors

Unenroll MFA

Remove MFA from a user’s account:

Enforce MFA with RLS

Require AAL2 for sensitive operations:

MFA in Mobile Apps

Flutter Complete Flow

Error Handling

Common MFA errors:

Time Synchronization

TOTP codes are time-sensitive. Ensure the user’s device clock is synchronized with network time for codes to work correctly.

Recovery Codes

Supabase doesn’t currently support recovery codes. Implement your own recovery mechanism or allow users to reset MFA via email verification.

Testing MFA

For testing, you can use:

Best Practices

Optional Enrollment

Make MFA optional initially, encourage adoption over time

Clear Instructions

Provide step-by-step instructions with screenshots

Backup Methods

Offer email-based recovery for locked accounts

Progressive Security

Require MFA only for sensitive operations

Next Steps

Row Level Security

Learn how to protect data with RLS policies

Storage Security

Secure file uploads and downloads