SecureStartKit
SecurityFeaturesPricingDocsBlogChangelog
Sign inBuy Now
Home/Glossary/Magic link
Authentication

Magic link

Also known as: email OTP, passwordless email login, magic email link

Definition

A magic link is a one-time email token that exchanges for a Supabase session when clicked. Magic links are single-use, rate-limited (default one per 60 seconds per user), expire after one hour, and use the PKCE flow when configured with token-hash email templates.

What is a magic link?

A magic link is a passwordless authentication method. The user submits their email, Supabase emails a link containing a one-time token, the user clicks it, and a server-side route exchanges the token for a session. No password is ever stored or transmitted.

How do you make magic links replay-resistant?

The token is single-use by default: once exchanged, it's invalidated server-side. Even if the email leaks through forwarded inbox archives or compromised browser extensions, the window of abuse closes the moment the legitimate user clicks the link. The default rate limit (one request per 60 seconds per user) blocks email-flooding attacks.

How should the click route be wired in Next.js?

A server-side Route Handler at /auth/confirm that reads the token_hash and type parameters from the URL, calls supabase.auth.verifyOtp({ type: 'magiclink', token_hash }), and on success redirects to a validated next path. Never call verifyOtp from a Client Component, which bypasses the server-side cookie write and exposes the token to inline scripts.

Learn more

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

Related terms

  • OAuthOAuth is an open standard for delegated authorization, used in Supabase apps as federated sign-in via providers like Google, GitHub, and Apple. The user authenticates with the provider, the provider returns an authorization code to a callback route, and the server exchanges the code for a Supabase session via PKCE.
  • PKCEPKCE (Proof Key for Code Exchange) is the OAuth 2.1 flow that prevents authorization-code interception by browser-based clients. The client generates a verifier, hashes it into a challenge, sends the challenge with the auth request, and presents the original verifier at the code-exchange step. An attacker who steals the code alone cannot complete the exchange.
  • @supabase/ssr@supabase/ssr is the official Supabase package for server-side authentication in Next.js, SvelteKit, and other SSR frameworks. It manages JWT storage in httpOnly cookies, handles the OAuth and magic-link callback cookie writes, and exposes createServerClient and createBrowserClient helpers for each context.
← 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