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:- Navigate to Authentication > Settings
- Scroll to “Multi-Factor Authentication”
- 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
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:- Google Authenticator (mobile)
- TOTP Generator Extension (browser)
- Command line tools like
oathtool
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
