SecureStartKit
SecurityFeaturesPricingDocsBlogChangelog
Sign inBuy Now
Home/Glossary/TOTP
Authentication

TOTP(Time-based One-Time Password)

Also known as: Time-based One-Time Password, authenticator code, authenticator app

Definition

TOTP (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.

What is TOTP?

TOTP is defined in RFC 6238. The authenticator app and the server share a secret (planted during enrollment via QR code or manual paste). Both sides apply HMAC-SHA1 over the current 30-second time window plus the secret to derive a six-digit code. Codes from the previous and next window are also accepted to handle clock drift.

Why is TOTP preferred over SMS?

SMS-based MFA is interceptable at the carrier level via SIM-swap attacks, SS7 protocol exploits, and social-engineering of mobile providers. TOTP secrets never leave the authenticator app after enrollment, so there is no in-flight credential to intercept. NIST removed SMS from its recommended MFA factors in 2017 for exactly this reason.

How is TOTP enrolled in Supabase?

Call supabase.auth.mfa.enroll({ factorType: 'totp' }), which returns a QR-code SVG and a secret. The user scans the QR with their authenticator app. The app generates a six-digit code, the user types it back, and your code calls mfa.challenge followed by mfa.verify to activate the factor. On successful verify, the current session is promoted to AAL2 and all other sessions are signed out.

Learn more

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

Related terms

  • MFAMFA (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.
  • 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.
← 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