Skip to main content
Platform security guideReviewed

Auth.js security: session strategy, secrets and the checks your routes make

Auth.js handles sign-in inside your own application, with installation steps for Next.js, Qwik, SvelteKit and Express, and its configuration decides how a session is stored, sealed and ended.

This guide follows those decisions in order, with a decision table to fill in for your own application and a local test set that illustrates the JWT and database session strategies side by side.

Auth.js session decision table and local test set

An illustration and a worksheet. Part 1 is a decision tree that settles which session strategy your configuration runs.

How to use it

Part 2 is a thirteen-item record sheet: where to look, what the named Auth.js page or advisory says, and what to write down, read-only and owner-run. Parts 3 to 5 are a Node.js lab with no installs and no Auth.js code, run on 127.0.0.1 with invented users and secrets, and the output it printed on Node.js v26.0.0.

authjs.txt

Introduction7 lines

AUTH.JS SESSION DECISION TABLE, WITH A LOCAL SESSION TEST SET ILLUSTRATION AND WORKSHEET. Part 1 is a decision tree that settles which session strategy your Auth.js configuration actually runs. Part 2 is a record sheet of thirteen items to fill in for your own application. Parts 3 to 5 are a local lab: two Node.js files written for this page, run on 127.0.0.1 with invented users and invented secrets, and the output they printed. The lab holds no Auth.js code. It illustrates the difference between JWT and database sessions; it does not test Auth.js. Every line under Docs in Part 2 comes from the Auth.js page or advisory named on the line, as read on 14 November 2026. Lines under This page's reading are this guide's inferences from them. Every item in Part 2 only reads. You read your own configuration files, the variable names in your hosting provider's environment settings and its member list, the values of AUTH_TRUST_HOST and AUTH_URL, which hold no secret, the lockfile of the build you deployed, counts from your own database, and this page's advisory log and the repository's advisories page, and you ask the person who runs your proxy one question. No item changes a setting, rotates a secret or sends traffic to a service you do not own, and no item asks you to open an environment settings screen or an .env file that shows a secret's value. Where the configuration file itself holds a secret, record only that it does. Record that a secret is set, never its value, and never copy a cookie, token or password into the sheet. Fill in one copy for each environment that issues sessions, and date it.

What Auth.js does in your application, and what it leaves to you

Auth.js is a library you install into your application.

The installation page shows one package per framework: next-auth for Next.js, installed with the beta tag, @auth/sveltekit for SvelteKit and @auth/express for Express, with Qwik added through its own CLI. In a Next.js application, a configuration file (auth.ts, by the documentation's convention) passes the options to NextAuth() and exports the auth function, the sign-in and sign-out methods and the handlers, and an App Router route handler exports those handlers as GET and POST.

The @auth/core reference gives that route's base path as /api/auth in next-auth and /auth in the other frameworks. The upgrade guide calls version 5 of the next-auth package NextAuth.js v5, and some advisories in the log below use the NextAuth.js name.

The Auth.js pages cited in this guide describe that version line: next-auth version 5, which the installation page and the upgrade guide install with the beta tag, and the @auth/* packages.

The session, secure-cookie and redirect defaults quoted below come from the @auth/core reference, and the next-auth reference gives the same ones for its own configuration type, NextAuthConfig. Version 4 appears here only in the upgrade guide's renames and in the advisories.

That arrangement puts many of the decisions in your hands. Auth.js runs the sign-in flows and creates the session, sealed into a cookie or stored in your database. Your configuration and code decide who may sign in, which roles exist, how long a session lasts and what each route checks.

The role-based access control guide says it in one line: determining the user's role is your responsibility. The credentials page says that by default the Credentials provider does not persist data in the database, and that you can still save data there but have to provide the necessary logic, for example to encrypt passwords, add rate limiting and add password reset.

Notices on the documentation site belong at the start of any review. The documentation pages read for this guide show the line "The Auth.js project is now part of Better Auth." The Auth.js security page says "Security updates are only released for the current latest version", and that old releases are not maintained and do not receive updates.

As read on 14 November 2026, it also said the @auth/* packages, other than the database adapters, were under development and, unless stated otherwise, not considered ready for production. The version item in the decision table exists because of those statements.

JWT or database sessions: the choice that decides what you can revoke

The session strategies page describes the JWT-based session and the database session as the main session strategies Auth.js supports, chosen with the session.strategy option.

The @auth/core reference gives the default as "jwt", an encrypted JWT in the session cookie, and says the default becomes "database" when an adapter is used, though "jwt" can still be forced. With the database strategy, the session cookie only contains a session token, which is used to look up the session in the database.

The session strategies page sets out what follows from each. With JWT sessions, signing out deletes the cookie, but expiring a token before its encoded expiry is not possible without a server-side blocklist, and a copy of the JWT saved elsewhere is accepted until it expires. With database sessions, signing out deletes the session from the database, and sessions can be modified on the server at any time, so you can implement features such as "sign out everywhere" or limiting concurrent logins, which the page says might be more difficult, but not impossible, with the JWT strategy.

The upgrade guide shows a third arrangement that is easy to miss. For an adapter that is not compatible with the Edge runtime, its example keeps the adapter in auth.ts, forces the jwt strategy there, and initialises Auth.js in the proxy without the adapter.

An application built that way keeps users and accounts in the database and still issues JWT sessions, so the JWT rules above apply to its sessions. Read the strategy the configuration produces, not the presence of a database.

This page's view: if your application needs to end a session from the server, after a staff member leaves or a laptop goes missing, the database strategy does that with a delete. If it uses JWT sessions, plan on a copied cookie working until it expires and set the maximum age with that in mind.

The JWT security guide covers the general trade-off between self-contained tokens and server-side sessions; this page stays with the Auth.js settings.

What to read in an Auth.js configuration that uses JWT sessions

Start with the lifetime.

The @auth/core reference gives session.maxAge a default of 2592000 seconds (30 days) and session.updateAge a default of 86400 seconds (1 day), and the upgrade guide says that whenever auth() is passed the response object it rotates the session expiry. The session strategies page says a saved copy of the JWT is accepted until it expires.

This page's reading is that maxAge, which the reference describes as the relative time from now when the session expires, is the figure to plan around.

Then the claims. The role-based access control guide persists a role in the JWT strategy by assigning user.role to token.role in the jwt callback on sign-in, and its example does so only when a user object is present. The reference says that callback is called whenever a token is created at sign-in or updated whenever a session is accessed in the client, that what it returns is saved in the token, and that the user parameter is available when the trigger is a sign-in or a sign-up.

The guide says that with this strategy, if you want to update the role, the user needs to be forced to sign in again.

Runs J6 and J7 in the lab illustrate that on invented code: the demoted user's old cookie still carries admin, and only a fresh sign-in carries the new role.

Two more callback details belong in the review. The reference says that, with the jwt strategy, the session parameter of the jwt callback carries data sent from the client through useSession().update, and that you should validate it before using it. It also says the session callback's return value is exposed to the client, and that by default only the email, name and image are returned. Any further field added there, such as a provider access token, is therefore sent to the browser.

Where the application calls a provider's API on the user's behalf, the refresh token rotation guide, as read on 14 November 2026, says there is no built-in solution for automatic refresh token rotation. With the jwt strategy, it says Auth.js libraries store the refresh_token in an encrypted JWT in an HttpOnly cookie, and that storing it in a cookie is simpler but less secure; with the database strategy, the access_token, expires_at and refresh_token are saved on the account for the provider.

By default, the token itself is encrypted. The jwt reference says Auth.js encrypts its JWT by default with the A256CBC-HS512 algorithm (JWE), using a key derived from AUTH_SECRET or the secret option passed in, and that these tokens are meant to be used by the same app that issued them; for JWT authentication to a third-party API, it points to your identity provider instead.

The session strategies page adds that data in an encrypted JWT should not be assumed to be impossible to decrypt at some point, and recommends a secret with high entropy.

AUTH_SECRET: where it is set and what depends on it

The installation page calls AUTH_SECRET the only mandatory environment variable, a random value used to encrypt tokens and email verification hashes.

The deployment page says it should be a cryptographically secure random string of at least 32 characters. Its value never belongs in a review record. What the review records is where it is set, in which environments, and who can read those settings.

The installation page says the Auth.js CLI adds the generated secret to the .env file, following the framework's convention, such as .env.local for Next.js. That is convenient on a laptop and worth checking in a repository, so the decision table asks for the names of any committed files that hold an AUTH_SECRET line, found with a search that lists file names only.

The upgrade guide says environment variables should be prefixed with AUTH_ and that NEXTAUTH_ is no longer in use, so the table also lists any NEXTAUTH_ variable still set, by name.

The @auth/core reference describes how to rotate the secret. The secret option can take an array, the first secret that successfully decrypts the JWT is used, and the newer secret goes at the start of the array, where it is used for all new sessions. Runs J8 to J10 in the lab follow that order: with the new secret first and the old one second, a cookie sealed under the old secret still opens; once the old secret is removed it does not, and a cookie sealed under the new secret keeps working.

Two deployment details reach the secret. For preview deployments that use AUTH_REDIRECT_PROXY_URL, the deployment page says the AUTH_SECRET value needs to be the same for the stable deployment and the previews that need OAuth, that the redirect is secured by relying on that shared secret, and that the stable deployment can be the main site.

On this page's reading, anyone who can read a preview's environment settings can read the secret the stable deployment uses, which is why the table asks who that is.

And GHSA-8fpg-xm3f-6cx3 names an unset AUTH_SECRET as one of the configuration errors behind the fail-open checks described in the route checks section below.

Secure cookies, the trusted host and redirects

The @auth/core reference says useSecureCookies, when true, makes all cookies set by NextAuth.js accessible only from HTTPS URLs, that it defaults to false on URLs that start with http:// and true for HTTPS sites, and that setting it to false is not recommended.

The separate cookies option overrides cookie names and options; the reference calls it an advanced option and says using it opts out of the built-in dynamic policy. The upgrade guide says the next-auth cookie prefix is renamed to authjs in version 5. On a version 5 site, then, the cookie names to look for contain authjs.

If either option is set in code, the question for the review is why. A hard-coded false, or a cookies override copied from an old example, sets in code what the defaults would otherwise decide. The cookie security guide covers what each attribute does; the check here is whether the configuration leaves the Auth.js defaults in force. The decision table's cookie item reads the configuration only, so that no step displays a session token.

Host handling depends on how you deploy. The reference says Auth.js relies on the incoming request's host header, that trustHost needs to be set to true for this reason, and that you should make sure your deployment platform sets the host header safely.

The deployment page says AUTH_TRUST_HOST needs to be set to true behind a reverse proxy, which tells Auth.js to trust the X-Forwarded-Host header, and that Auth.js infers it on supported hosting providers, which the page, as read on 14 November 2026, names as VERCEL and CF_PAGES (Cloudflare Pages); in Docker, it says to set trustHost or AUTH_TRUST_HOST to true.

The upgrade guide says that when AUTH_TRUST_HOST is true, Auth.js trusts the X-Forwarded-Proto header as well as X-Forwarded-Host.

The person who runs the proxy in front of the application is the one to confirm that it sets those headers itself rather than passing on whatever arrived with the request.

The reference says the redirect callback is called anytime the user is redirected to a callback URL, such as on sign-in or sign-out, that by default only URLs on the same host as the origin are allowed, and that the callback can be used to customise that behaviour. Where a custom one exists, the table records every host it lets through.

Providers, scopes, account linking and adapter records

Each provider requests the scopes it is configured with.

The guide to configuring OAuth providers says options passed to a provider are deeply merged with its defaults, and that overriding "authorization.params.scope" is enough to change the scopes. This page's advice: list each provider's scopes next to the feature that uses them, because a scope nothing uses is access granted for no purpose, and with an adapter the tokens that carry it are stored by default, as the next paragraph shows.

The database models page says the Account model saves access_token, expires_at, refresh_token, id_token, token_type, scope and session_state by default, and the providers reference says a provider's account callback returns the subset that is saved. An account table can therefore hold provider tokens for every user who has signed in through an OAuth provider, so the decision table asks whether those columns hold values, as a count, and who can read the table, never for the values.

The database models page also says an expired session is deleted when it is read, and that each email sign-in token is usable only once, with a default lifetime of 1 day. The magic links page says an email provider cannot be enabled without a database.

The OAuth checks and linking rules are provider settings too. The providers reference gives the checks option a default of PKCE, says state is added automatically when a redirect proxy URL is set, and lists none, state, nonce and pkce as the values for OpenID Connect providers.

It says accounts with the same email address are not linked automatically on OAuth sign-in, that automatic account linking on sign-in is not secure between arbitrary providers and is disabled by default, and that allowDangerousEmailAccountLinking turns it on, which it says may be desirable if you trust the provider to have securely verified the email address.

The database models page says linking otherwise happens automatically only when the addresses match and the user is signed in. The OAuth and OpenID Connect guide explains what state, nonce and PKCE each protect.

The deployment page also recommends a different OAuth app for development and production when users are stored in a database, so that test and production user bases do not mix. The table records which OAuth app each environment uses.

Callbacks and route handlers: where the access decision is made

Auth.js gives you several places to make an access decision, and they are not equivalent.

The signIn callback, which the @auth/core reference says controls whether a user is allowed to sign in, decides who gets a session at all. The "authorized" callback, which the next-auth reference says is invoked when a user needs authorisation using Middleware, decides what the proxy lets through. The protecting resources page says not to rely on the proxy exclusively for authorisation, and to verify the session as close to your data fetching as possible.

The Next.js guide explains why middleware is a filter rather than the boundary; for Auth.js, the question is what each check actually tests.

One advisory answers that question directly. GHSA-8fpg-xm3f-6cx3 (CVE-2026-73421), published on 20 July 2026, says that when the Auth.js configuration produces a server-side error, the auth object is populated with an error object instead of being null, so an application that checks only whether the auth object exists treats every request, including unauthenticated ones, as authenticated.

It lists next-auth 5.0.0-beta.0 to 5.0.0-beta.31 as affected and 5.0.0-beta.32 as patched, and says there is no impact while the configuration is valid. Its workaround, for those who cannot upgrade immediately, is to check a concrete property such as auth.user rather than the bare object.

The protecting resources page, as read on 14 November 2026, shows existence checks in its examples: its proxy example's "authorized" callback returns !!auth, and its Next.js App Router API route example returns the session when req.auth is present.

The next-auth reference example for the same callback returns !!auth.user. The advisory says its fix makes existence checks fail closed rather than open. Checking for the user rather than the object is the form both the advisory's workaround and the reference example use.

Runs R1 and R2 in the lab illustrate the difference on invented code: with no secret configured, the existence check lets a request with no cookie through and the user check refuses it.

A session is still not permission. GHSA-v64w-49xw-qq89 notes that the existence of a NextAuth.js session state can provide simple authentication, but not authorisation, and the role-based access control guide shows the server-side form: import the auth function and verify that the user has the expected role. This page's advice is that each route handler and server function returning data makes that check itself, against the record being asked for.

next-auth advisories to check your version against

This log lists advisories from the nextauthjs/next-auth repository that bear on the settings in this guide, each read on its repository advisory page on 14 November 2026.

Version ranges come from each advisory's version fields. It is a log as of that date, not a complete list: the repository's advisories page also holds earlier advisories, including advisories published in 2022, and is the place to check for newer ones. Compare the resolved next-auth version in the lockfile of your deployed build with each entry.

  • GHSA-8fpg-xm3f-6cx3 (CVE-2026-73421), published 20 July 2026: configuration errors can make existence-based auth checks fail open. Affected: next-auth 5.0.0-beta.0 to 5.0.0-beta.31. Patched: next-auth 5.0.0-beta.32. Workaround, if you cannot upgrade immediately: check a concrete property such as auth.user rather than the bare auth object.
  • GHSA-x445-f3h2-j279 (CVE-2026-73419), published 20 July 2026: in affected versions, the cookies that hold the OAuth state, nonce and PKCE verifier are not bound to the provider that created them, which in a multi-provider app that allows account linking while logged in can let an attacker link their account at a second provider to a victim's user. Affected: next-auth up to 4.24.14 and 5.0.0-beta.1 to 5.0.0-beta.31, and @auth/core up to 0.41.2. Patched: next-auth 4.24.15 and 5.0.0-beta.32, and @auth/core 0.41.3. The advisory says apps with a single OAuth provider, no logged-in account linking, or PKCE enforced by every provider are not affected.
  • GHSA-7rqj-j65f-68wh (CVE-2026-73420), published 20 July 2026: the default email normaliser for magic-link sign-in validates the address before Unicode normalisation, so a mail library that normalises the address may deliver the sign-in link to a different recipient than intended. Affected: next-auth from 4.10.3 to before 4.24.15 and 5.0.0-beta.1 to 5.0.0-beta.31, and @auth/core from 0.1.0 to before 0.41.3. Patched: next-auth 4.24.15 and 5.0.0-beta.32, and @auth/core 0.41.3. The advisory says apps that do not use the email provider, or whose normaliser or mailer rejects or canonicalises non-ASCII addresses before validating them, are not affected.
  • GHSA-xmf8-cvqr-rfgj (CVE-2026-73418), published 20 July 2026: getToken() can throw an uncaught exception when it reads a malformed Bearer header. Affected: next-auth 4.0.6 to 4.24.14 and 5.0.0-beta.0 to 5.0.0-beta.31, and @auth/core from 0.1.0 to before 0.41.3. Patched: next-auth 4.24.15 and 5.0.0-beta.32, and @auth/core 0.41.3. The advisory says apps that only use the framework's auth() helper and never call getToken() themselves, or that wrap every getToken() call in their own exception handling, are not affected.
  • GHSA-5jpx-9hw9-2fx4, "NextAuthjs Email misdelivery Vulnerability", published 27 October 2025, with no known CVE: email sign-in can be forced to deliver authentication emails to an attacker-controlled mailbox because of a bug in the nodemailer address parser the project uses, which the advisory says was fixed in nodemailer v7.0.7. Affected: next-auth below 4.24.12 and below 5.0.0-beta.30. Patched: next-auth 4.24.12 and 5.0.0-beta.30.
  • GHSA-v64w-49xw-qq89 (CVE-2023-48309), published 20 November 2023: next-auth applications prior to 4.24.5 that rely on the default Middleware authorisation are affected, because a JWT from an interrupted OAuth sign-in flow could stand in for the session cookie and simulate a logged-in user with no user information. Affected: next-auth below 4.24.5. Patched: next-auth 4.24.5.
  • GHSA-7r7x-4c4q-c4qf (CVE-2023-27490), published 9 March 2023: in next-auth applications using OAuth before 4.20.1, someone who can spy on the victim's network, or who gets the victim to click a manipulated login link, could intercept and tamper with the authorisation URL to log in as the victim, bypassing the CSRF protection. Affected: next-auth below 4.20.1. Patched: next-auth 4.20.1.

How to fill in the decision table

The asset on this page has five parts.

Part 1 is a decision tree: two questions settle which session strategy your configuration really runs, and the answer says which items in Part 2 carry the most weight. Part 2 is the record sheet, thirteen items, each naming where to look, what the named Auth.js page or advisory says and what to write down, with the lab runs that show the behaviour where there are any. Parts 3 to 5 are the lab described in the next section.

  • Work from the configuration files, the variable names in your hosting provider's environment settings and its member list, the values of AUTH_TRUST_HOST and AUTH_URL, the lockfile of the deployed commit, counting queries on your own database, the advisory log on this page and the repository's advisories page, and the person who runs your proxy. Every item only reads; none changes a setting, rotates a secret or sends traffic to a service you do not own, and none asks you to open an environment settings screen or an .env file that shows a secret's value.
  • Record that a secret is set, never its value, and never copy a cookie, token or password into the sheet. Where an item looks at a file, a table or a configuration that can hold a secret or a token, it asks for a yes or no, a count or a name, never the secret or token itself.
  • Fill in one copy for each environment that issues sessions: production, staging and previews. Previews that use the redirect proxy share the stable deployment's AUTH_SECRET by design, as the AUTH_SECRET section explains.
  • Date each copy and note the next-auth version it was read against. A change to the configuration file, the adapter or the next-auth version is the moment to fill it in again.

Running the session test set on your own machine

Parts 3 to 5 of the asset illustrate the difference between JWT and database sessions.

They are not a test of Auth.js, and the lab holds no Auth.js code. It runs a small server with two invented users, ada (admin) and ben (member), in two modes. In sealed cookie mode the session is encrypted into the cookie with AES-256-GCM, in a format of the lab's own rather than Auth.js's JWE, and nothing is kept on the server.

In database mode the cookie holds a random id, and the server keeps a session row and reads the user's current role on each request.

The secrets are invented and labelled so in the code. The server binds to 127.0.0.1 at a port the system picks and keeps everything in memory. Apart from the runner importing the lab file, the two files import only node:http and node:crypto, and nothing is installed.

Part 5 holds the output of node run-session-tests.mjs on Node.js v26.0.0 with the files as shown, copied from the captured file by a script.

Run node run-session-tests.mjs in a folder holding the two files. It prints a line for each run, never prints a cookie's value, names each cookie the lab server issued at sign-in by a letter, and stops every server before it exits. This is what each group of runs showed; Part 5 has the exact lines.

  • J1 and D1: the admin cookie was accepted on GET /admin/report in both modes (200).
  • J2, J3, D2 and D3: a cookie with one character changed, a cookie sealed under a secret the server does not hold, and an id the server never issued were each refused with 401.
  • J4 and D4: a cookie saved before signing out and sent again afterwards was accepted in sealed cookie mode (200) and refused in database mode (401).
  • J5 and D5: when the server ended every session for ada, sealed cookie mode had nothing to end (sessions ended: 0) and the old cookie was still accepted; database mode ended one session and the cookie was refused.
  • J6, J7 and D6: after ada was demoted to member in the user store, the old sealed cookie still carried admin and was accepted, while a fresh sign-in carried member and was refused with 403. Database mode read the current role and refused the existing session with 403.
  • J8, J9 and J10: with the new secret first and the old one second, the old cookie was accepted; once the old secret was removed it was refused, and a cookie sealed under the new secret was accepted.
  • J11 and D7: once the lab clock passed the maximum age, both modes refused the cookie, and database mode printed 0 session rows left after the expired read.
  • R1 and R2: with no secret configured, the session reader returned an error object, modelled on the behaviour GHSA-8fpg-xm3f-6cx3 describes. The existence check accepted a request with no cookie, and the check for session.user refused it.

Using the same runs on your own application

The runner sends every request over HTTP, and makes the demotion, the session ending, the secret change and the clock move in the lab's memory. The HTTP part of the sequence can be pointed at a local or staging copy of your own application: sign in as a test account you created, with an email address you control, keep the cookie in the test script's memory as the lab does, never in notes or logs, then sign out or demote that test account and send the cookie again.

Keep each run to no more than five requests, never use a real user's session, and run it only against applications you own or are authorised in writing to test. The R runs need a server with no secret configured, so they stay in the lab.

What a review of your own configuration cannot show

The decision table describes how your configuration is meant to behave.

Some questions need evidence it cannot hold.

  • Whether a copied cookie is already in someone else's hands. The table shows how long a copy would keep working, not whether one exists.
  • What the identity provider does on its side: whether it verified an email address, which scopes a user consented to, and how its own sessions end. Those settings live with the provider and its own documentation.
  • Whether every handler checks its caller. Part 2 lists the handlers you know about; routes added later, or reachable in forms the proxy matcher does not cover, need testing against the running application.
  • Whether the proxy in front of the application sets X-Forwarded-Host itself. The configuration shows trustHost; only the proxy's own settings, or a request to the running application, show what reaches it.
  • Whether your own code around Auth.js holds: ownership checks, the way roles are updated, and what a session callback returns. A flaw there belongs to the application, and an Auth.js upgrade leaves it in place.
  • Which attributes the production site's cookies actually carry. The table reads the configuration, so the cookies the running site sets need checking against the running application.

Where an outside test fits

This guide covers a review you can run on your own configuration.

It does not describe a test of the Auth.js library or of any identity provider's platform. Active testing of your own running application sits within a scoped Clever Ops web application and API penetration test, a signed-in test of a custom application whose coverage includes authentication and sessions and what each role can see and change.

Its session checks include replaying the old session after sign-out to see whether the server still accepts it, and checking whether an account's open sessions stop working once an administrator suspends that account.

For the code itself, a Clever Ops secure code review reads custom web applications and their APIs, such as Next.js, React and Node applications, through read-only access to your repository. Its written scope names the areas read, for example the authorisation layer and every route that returns customer data. In an Auth.js application, the callbacks and route checks above sit in those areas.

In the report, every finding carries its evidence, a fix written for your stack and the criteria its retest will use. When Clever Ops built or hosts the application, the work is called a security review rather than an independent test, and the report records who built the application and who hosts it.

Frequently asked questions

With database sessions, your application can: the Auth.js session strategies page says database sessions can be modified on the server at any time, so you can implement features such as "sign out everywhere". With JWT sessions, it says expiring a token before its encoded expiry needs a server-side blocklist, and that a copy of the JWT saved elsewhere is accepted until it expires, even after Auth.js destroys the cookie. The @auth/core reference gives a default maximum age of 30 days, so check what yours is set to.

The @auth/core reference gives the default as "jwt", an encrypted JWT in the session cookie, and says it becomes "database" when an adapter is used. A JWT strategy can still be forced alongside an adapter, which the upgrade guide shows for adapters that are not compatible with the Edge runtime. Read the adapter option and session.strategy together to know which one runs.

The @auth/core reference says the secret option accepts an array: the first secret that successfully decrypts a JWT is used, and the newer secret goes at the start of the array, where it is used for all new sessions. This page's advice is to remove the old secret once sessions sealed under it have passed their maximum age. The deployment page asks for a cryptographically secure random string of at least 32 characters.

Yes. They are published as security advisories in the nextauthjs/next-auth repository on GitHub. Each advisory in this page's log that was published on 20 July 2026 lists next-auth 5.0.0-beta.32 as patched for version 5, and those that also affect version 4 list next-auth 4.24.15. Check the resolved version in your deployed lockfile against the log on this page, then against the repository's advisories page for anything newer. The Auth.js security page says "Security updates are only released for the current latest version".

Not by default. The @auth/core providers reference says accounts with the same email address are not linked automatically on OAuth sign-in, that automatic account linking on sign-in is not secure between arbitrary providers and is disabled by default, and that allowDangerousEmailAccountLinking turns it on, which it says may be desirable if you trust the provider to have securely verified the address. The database models page says linking otherwise happens automatically only when the addresses match and the user is signed in.

With JWT sessions, the Auth.js role-based access control guide stores the role in the token through the jwt callback at sign-in, and says that with this strategy, if you want to update the role, the user needs to be forced to sign in again. With database sessions, the guide's session callback copies the role from the user record, and the @auth/core reference says that callback is called whenever a session is checked. Runs J6 and D6 in this page's lab illustrate both on invented code.

Scope the right test for your application

Tell us what you have built, who uses it and when it needs to launch. You will get a plain-English recommendation: a website audit, a web application test or a referral to a specialist.