Guides
Email
Risk
Integrations
TypeScript SDK
Tools
AI agents
Auth.js
An Auth.js (NextAuth.js) email provider that sends magic sign-in links through coss.com.
coss/authjs is an email provider for Auth.js (NextAuth.js v5 and the other
@auth/* frameworks). It sends Auth.js's magic sign-in links through coss.com.
npm install coss next-auth@betaexport const { , , , } = ({
, // email sign-in stores its tokens, so it needs a database adapter
: [({ : "Acme <auth@acme.com>" })],
});Set AUTH_COSS_KEY (Auth.js's naming for a provider's key) or COSS_API_KEY, or pass apiKey.
Sign in with signIn("coss", { email }).
Options
({
: "Acme <auth@acme.com>",
: 24 * 60 * 60, // how long a link works, in seconds (the default)
: "Email", // the button label on Auth.js's sign-in page
: ({ , }) => ({
: `Sign in to ${}`,
: `<a href="${}">Sign in</a>`,
: `Sign in to ${}: ${}`,
}),
});Without render, the email is Auth.js's own sign-in email, in your theme's
brand color.
Behaviour
- Links go out with
category: "account"and open and click tracking off. - The idempotency key is a hash of the link's token, so a retried request sends the link once.
- When coss.com refuses the email,
sendVerificationRequestthrows aCossSendError, which fails the sign-in attempt.