Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Auth.js · Const

Postmark

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.

How it works

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.

Syntax

import Postmark from "next-auth/providers/postmark"

providers: [Postmark]

Key points

  • Postmark enables passwordless sign-in through email links that carry verification tokens.
  • A verification token normally expires after 24 hours.
  • Using a valid link can create the account and complete sign-in.
  • Postmark may be combined with OAuth providers or used as the sole sign-in method.
  • The conventional AUTH_POSTMARK_KEY variable is automatically recognized.
  • With configuration complete, sign-in starts through the Auth.js sign-in endpoint.

Common mistakes

  • Email sign-in requires a configured database adapter because verification tokens must be stored.
  • The sending domain must be added to Postmark and match the domain used by the provider's from address.
  • Set up the database adapter before enabling the provider.

Example: Postmark email sign-in setup

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.

When to use it

Magic-link sign-in

Offer passwordless authentication without requiring users to create or remember passwords.

Combined authentication methods

Provide email authentication alongside social login options.

Email authentication with session management

Use Auth.js sessions while retaining persistent verification-token storage.

Interview questions

QHow does Postmark authentication work?

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.

QWhat session strategies are supported?

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.

QHow is the Postmark API key configured?

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 Providers
  • Verification Token
  • database adapter
  • OAuth providers
  • AUTH_POSTMARK_KEY
  • signIn

Source: Postmark - Auth.js. Checked 2026-10-15.