SecureStartKit
SecurityFeaturesPricingDocsBlogChangelog
Sign inBuy Now
Home/Glossary/MFA
Authentication

MFA(Multi-Factor Authentication)

Also known as: Multi-Factor Authentication, two-factor authentication, 2FA

Definition

MFA (Multi-Factor Authentication) requires a user to prove identity with a second factor beyond their password or OAuth login. In Supabase, MFA is implemented via TOTP (authenticator app) or phone (SMS). Successful verification promotes the session to AAL2, which RLS policies can gate on.

What is MFA in a Supabase + Next.js app?

MFA layers a second authentication factor on top of the primary one. Supabase ships two factor types: TOTP (a six-digit code from an authenticator app like Authy or 1Password) and Phone (SMS or WhatsApp). TOTP is the recommended default; SMS has known carrier-level interception risks.

How is MFA enforced architecturally?

Three layers, all required. Enrollment happens via supabase.auth.mfa.enroll, then challenge and verify to activate the factor. Server Actions read getClaims() and check claims.aal === 'aal2' before sensitive operations. RLS policies on admin tables use restrictive policies requiring auth.jwt() ->> 'aal' = 'aal2'. The database-layer gate is what makes MFA architectural rather than a UI checkbox.

When should you enforce MFA?

On admin accounts at minimum. For consumer apps, MFA is opt-in for users who want it. For B2B SaaS handling sensitive data, MFA is typically mandatory for all admin and owner roles, and enforced by RLS rather than just by UI.

Learn more

  • Supabase OAuth, Magic Links, MFA in Next.js

Related terms

  • TOTPTOTP (Time-based One-Time Password) is a six-digit code generated every 30 seconds from a shared secret. The user scans a QR code at enrollment, their authenticator app derives the secret, and Supabase verifies the code by computing the same derivation. TOTP is the recommended MFA factor over SMS.
  • AALAAL (Authenticator Assurance Level) is a JWT claim that reflects how strongly the user authenticated. AAL1 means one factor (password, OAuth, magic link). AAL2 means a second factor verified for this session (TOTP code). RLS policies read `auth.jwt() ->> 'aal'` to gate sensitive operations.
  • Row Level SecurityRow Level Security is a Postgres feature that filters which rows of a table each user can see or modify. In Supabase apps, RLS policies are written in SQL and evaluated on every query against the authenticated user's JWT claims, making the database itself the authorization boundary.
← Back to full glossary
SecureStartKit

The security-first Next.js SaaS template. Auth, payments, and everything you need to launch - with backend-only data access, Zod validation on every input, and built-in optimization for AI coding agents.

Summarize with AI

Product

  • Security
  • Features
  • Pricing
  • FAQ
  • Docs
  • About

Use Cases

  • For Indie Hackers
  • For Solo Developers
  • Fintech SaaS
  • Internal Tools
  • Healthtech SaaS

Free Tools

  • All Tools
  • RLS Policy Generator
  • Security Checklist
  • Security Headers
  • JWT Decoder
  • JWT Generator
  • CORS Config Generator
  • JSON to Zod Converter
  • API Key Generator
  • Stripe Webhook Verifier
  • Stripe Fee Calculator
  • SaaS Pricing Calculator
  • Tech Stack Costs
  • OG Image Preview

Compare

  • All comparisons
  • vs ShipFast
  • vs Makerkit
  • vs Supastarter
  • vs Divjoy
  • vs Nextbase
  • One-time vs subscription

Resources

  • Blog
  • Glossary
  • Security Patterns
  • Changelog
  • Contact
  • Privacy
  • Terms

More from the same maker

  • AppScreenshotStudio
  • QueryScope
  • FrictionScope
  • MCP Hunter
  • BookIllustrationAI
  • MyCVCraft
  • StyleMyFade

© 2026 SecureStartKit. All rights reserved.

Built with SecureStartKit