Most users forget their SaaS password within a week of signing up. Then they click "forgot password," wait for an email, click a link, and create a new one -- two round trips to the login flow before they did anything useful in your product.
Magic links skip the password entirely. The user types their email, clicks a link in their inbox, and they are in -- authenticated, no password created or stored. It is the same pattern Notion used early on, and it works especially well for products where users sign in once a week or less.
This post shows how to add passwordless magic link login to your Next.js SaaS using the JWT and Resend setup that is already in the boilerplate.
The flow has five steps:
https://yourapp.com/auth/verify?token=...Three properties make this secure: tokens expire after 15 minutes, each token can only be used once, and the user has to access their actual email inbox to complete the login. There are no passwords to store or hash -- which removes a whole class of security risk.
Magic links are not always better than passwords. Here is the decision framework:
Use magic links when:
Stick with passwords when:
Many SaaS products offer both. A magic link option sits alongside the password form as a "sign in with email" button -- useful for users who forgot their password and for products that want to minimize sign-in friction on first use. The Next.js SaaS Boilerplate already ships with password auth, so magic links become an additional path rather than a replacement.
Here is the full picture of what the feature requires -- and how much of it you already have.
One new database table: magic_tokens with a hashed token, the email it was issued for, an expiry timestamp, and a used flag. You store the SHA-256 hash of the token, not the raw value.
Two new API routes:
POST /api/auth/magic-link/request
magic_tokens with a 15-minute expiryGET /api/auth/magic-link/verify?token=...
used flag -- reject if either failsOne email template: A clean "Sign in to [Your App]" email with a single button. The link expires in 15 minutes so the copy should say that clearly so users do not save the link for later.
The password reset flow uses the same short-lived JWT-in-email pattern. Magic link auth is that same flow -- just without the "create a new password" step at the end. If you have already built password reset, magic links take a few hours, not a day.
If you have added Google and GitHub sign-in, you can offer all three auth methods -- password, magic link, and OAuth -- from the same login page. The session JWT is identical regardless of how the user authenticated, so your middleware and getUserFromRequest() calls do not change.
This covers every user preference without requiring you to maintain a separate auth service or pay for Auth0.
On the Next.js SaaS Boilerplate, you already have:
lib/auth.ts -- JWT signing, verification, and getUserFromRequest()lib/email.ts -- emailService.sendEmail() wired to Resendmodules/user/ -- the user lookup and creation patternmagic_tokens in one schema file and run a migrationYou are writing two API routes and one email template. Everything else is already there.
Magic link login is one of the most user-friendly improvements you can make to a SaaS MVP. It removes the password memory problem, eliminates a storage risk, and takes an afternoon to build when your JWT and email infrastructure is already in place.
Get the boilerplate and add passwordless auth to your SaaS today: boilerplate.iteam-company.com