Magic-link authentication
Offer passwordless email login without requiring users to create or remember passwords.
Auth.js · Const
Resend is an Auth.js passwordless email provider that sends magic links with verification tokens. It requires a database adapter, a verified sending domain, and a Resend API key.
Resend is Auth.js’s passwordless email provider. It sends a verification link containing a token; the token is stored through a database adapter and, when followed before expiry, signs the user in or creates the account.
Resend(options)| Name | Type | Description |
|---|---|---|
options | ResendConfig | Optional provider settings, including the sending address and API key; the documented example configures from. |
A configured Resend email provider for the Auth.js providers array.
from.import NextAuth from "next-auth"
import Resend from "next-auth/providers/resend"
export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [
Resend({
from: "no-reply@company.com",
}),
],
})Register Resend as an email provider; the provider reads AUTH_RESEND_KEY automatically and sends sign-in links from the configured address.
Offer passwordless email login without requiring users to create or remember passwords.
Provide email login together with Google, GitHub, or other OAuth providers.
Use Resend’s email delivery service for Auth.js verification messages.
Resend implements passwordless authentication by emailing a verification token inside a sign-in URL. A valid link signs in an existing account or creates a new account for the email address.
Follow-up: Why is a database required? The verification token must be stored, so email authentication cannot be enabled without a database adapter.
The default token lifetime is 24 hours. The user must follow the emailed link during that period for the token to be accepted.
Follow-up: How would you change the lifetime? Configure the email provider’s maxAge according to the broader Auth.js email-provider configuration.
Configure a database adapter, add a verified Resend domain, generate an API key, and expose it as AUTH_RESEND_KEY. Then register Resend in the providers array and configure a suitable from address.
Follow-up: What happens if the environment variable is renamed? Pass the renamed value explicitly in the Resend provider configuration.
Email ProviderVerification Tokendatabase adapterAUTH_RESEND_KEYfromNextAuth