Magic-link sign-in
Offer passwordless authentication without requiring users to create or remember passwords.
Auth.js · Const
Postmark is an Auth.js email provider for passwordless sign-in. It sends tokenized magic links and requires a database adapter to store verification tokens.
Postmark is an email provider for passwordless authentication. Auth.js sends a verification link containing a token, stores the token through a database adapter, and signs the user in after the link is used.
import Postmark from "next-auth/providers/postmark"
providers: [Postmark]import NextAuth from "next-auth"
import Postmark from "next-auth/providers/postmark"
import { PrismaAdapter } from "@auth/prisma-adapter"
import { prisma } from "./prisma"
export const { handlers, auth, signIn, signOut } = NextAuth({
adapter: PrismaAdapter(prisma),
providers: [Postmark],
})Configure the provider with a database adapter; AUTH_POSTMARK_KEY is discovered automatically.
Offer passwordless authentication without requiring users to create or remember passwords.
Provide email authentication alongside social login options.
Use Auth.js sessions while retaining persistent verification-token storage.
Postmark provides passwordless email authentication. Auth.js sends a verification token in a link, and following a valid link creates or signs into the corresponding account.
Follow-up: Why is an adapter required? Verification tokens need persistent storage, so email sign-in cannot operate without a database.
The provider can use either JWT-managed or database-managed sessions, but a database is still required for the email verification token. Configure an adapter in the Auth.js options.
Follow-up: What must be changed when using a custom environment-variable name? Pass that variable explicitly as the provider's apiKey option.
Set AUTH_POSTMARK_KEY to the Postmark API key and use Postmark in the providers array. Auth.js detects that conventional variable automatically; an alternative variable name must be passed manually.
Follow-up: What external Postmark setup is needed? Add the sending domain to Postmark and generate an API key in its dashboard.
Email ProvidersVerification Tokendatabase adapterOAuth providersAUTH_POSTMARK_KEYsignIn