React & Next.js

NextAuth v5 Beta Status: What npm Installs in December 2026

Table of Contents

This post is for Next.js developers who followed a 2026 tutorial, typed npm install next-auth, and then found that export const { handlers, auth } = NextAuth(...) does nothing. It is also for teams deciding whether to ship on the NextAuth v5 beta at all. The short version: npm install next-auth still gives you v4. The v5 line has been in beta since October 2023, and the project now belongs to Better Auth. Most guides skip all three facts. So this post reads the npm registry, the npm advisory database and the GitHub repository on one day, and pastes every response. As a result, you get the exact version each command installs, whether each line accepts Next.js 16.5, which versions carry open advisories, and how many downloads still land on them.

Everything below comes from public endpoints, read on one day:

Read 2026-12-03 (UTC), from Windows 11 Pro 25H2 with curl 8 in Git Bash
npm registry: registry.npmjs.org (dist-tags, version manifests, publish times)
npm downloads API: api.npmjs.org, last-week window 2026-11-25 to 2026-12-01
npm advisory database: the bulk endpoint that npm audit calls
GitHub: nextauthjs/next-auth repository, README and security advisories
Versions on that day: next-auth 4.24.15 (latest) and 5.0.0-beta.32 (beta),
  next 16.5.0, react 19.3.1, better-auth 1.7.29, @auth/core 0.41.3
Raw data: data/nextauth-versions-2026-12-03.tsv in the publisher repo

Registry reads are deterministic, so one read per endpoint is the result. Download counts move daily, so treat those as a one-week snapshot. This PC has no Node.js, so nothing here ran npm install. Every claim about what npm installs comes from the dist-tags npm resolves against, and the post marks it where it matters.

NextAuth v5 Beta Status: The Short Answer

QuestionAnswer on 2026-12-03
What does npm install next-auth install?4.24.15, the latest dist-tag
What does npm install next-auth@beta install?5.0.0-beta.32
How long has v5 been in beta?Since 5.0.0-beta.0 on 2023-10-24, 33 betas so far
Last release of either line2026-07-20, both lines on the same day
Last commit to the repository2026-07-22
Do both lines accept Next.js 16.5 and React 19.3?Yes, by their declared peer ranges
Open advisories on the newest versionsNone for 4.24.15 or 5.0.0-beta.32
Downloads last week on versions with an open advisory2,592,899 of 8,447,108 (30.7%)
Who maintains itThe Better Auth team, since September 2025
What the README recommends for new projectsBetter Auth

In short, the beta is the version most new code is written for, and it is not the version npm hands you by default. Meanwhile, the project is in maintenance mode under new owners who recommend their own library. Each row has its source further down.

What Does npm install next-auth Actually Install?

npm resolves a bare package name to the latest dist-tag. A dist-tag is a named pointer to one version, and a maintainer moves it by hand when they publish. The npm dist-tag documentation describes this: npm install <pkg> uses latest unless you name another tag. Therefore the dist-tags record answers the install question directly:

curl -s https://registry.npmjs.org/-/package/next-auth/dist-tags
{"canary":"3.24.0-canary.0","next":"4.0.0-next.26","next-auth-3":"3.29.10","experimental":"0.0.0-manual.2824fa11","latest":"4.24.15","beta":"5.0.0-beta.32"}

latest points at 4.24.15 and beta points at 5.0.0-beta.32. Notably, the next and canary tags are leftovers from the v3 and v4 eras, so npm install next-auth@next gives you a 2021 prerelease of v4, not v5. That is a trap for anyone who guesses the tag name.

How Long Has NextAuth v5 Been in Beta?

The registry stores a publish time for every version. Here are the first and the latest v5 betas:

curl -s https://registry.npmjs.org/next-auth | grep -oE '"5\.0\.0-beta\.(0|32)":"[^"]+"'
"5.0.0-beta.0":"2023-10-24T00:49:00.256Z"
"5.0.0-beta.32":"2026-07-20T22:57:40.465Z"

That is 1,136 days from the first beta to the day of this read, and 33 numbered betas. Moreover, the cadence has slowed sharply. The registry lists 21 betas published in 2024, five in 2025 (beta.26 to beta.30), and only two in 2026 (beta.31 on 2026-04-14 and beta.32 on 2026-07-20). Each 2026 beta shipped alongside a v4 patch on the same day, which reads like security maintenance rather than progress toward a stable release.

The repository says the same. The GitHub API reported the last push on 2026-07-22, a docs commit updating the security reporting contact. No commits landed in the 134 days after that. Meanwhile, a community discussion titled How many more years of beta releases for v5? is still open. No maintainer statement announces a stable date, and this post does not guess one.

Do Both Lines Accept Next.js 16.5?

Each version declares the framework versions it supports as peer dependencies. Here are both current versions:

curl -s https://registry.npmjs.org/next-auth/4.24.15 | grep -oE '"peerDependencies":\{[^}]*\}'
curl -s https://registry.npmjs.org/next-auth/5.0.0-beta.32 | grep -oE '"peerDependencies":\{[^}]*\}'
"peerDependencies":{"next":"^12.2.5 || ^13 || ^14 || ^15 || ^16","react":"^17.0.2 || ^18 || ^19","react-dom":"^17.0.2 || ^18 || ^19","@auth/core":"0.34.3","nodemailer":"^7.0.7"}
"peerDependencies":{"next":"^14.0.0-0 || ^15.0.0 || ^16.0.0","react":"^18.2.0 || ^19.0.0","nodemailer":"^7.0.7 || ^8.0.5","@simplewebauthn/server":"^9.0.2","@simplewebauthn/browser":"^9.0.1"}

Next, the current versions of each peer, read the same way:

curl -s https://registry.npmjs.org/-/package/next/dist-tags | grep -oE '"latest":"[^"]+"'
curl -s https://registry.npmjs.org/-/package/react/dist-tags | grep -oE '"latest":"[^"]+"'
curl -s https://registry.npmjs.org/-/package/nodemailer/dist-tags | grep -oE '"latest":"[^"]+"'
curl -s https://registry.npmjs.org/-/package/@simplewebauthn/server/dist-tags | grep -oE '"latest":"[^"]+"'
"latest":"16.5.0"
"latest":"19.3.1"
"latest":"10.6.3"
"latest":"14.1.0"

Putting the two together:

Peer (latest on 2026-12-03)next-auth 4.24.15 rangeInside?5.0.0-beta.32 rangeInside?
next 16.5.0^16Yes^16.0.0Yes
react 19.3.1^19Yes^19.0.0Yes
nodemailer 10.6.3 (optional)^7.0.7No^7.0.7 || ^8.0.5No
@simplewebauthn/server 14.1.0 (optional)not usedn/a^9.0.2No

So both lines accept the current Next.js and React, which is the question most people ask. The friction sits in the optional peers. If you use the email (magic link) provider with today’s nodemailer, or passkeys with today’s SimpleWebAuthn, your version falls outside the declared range on both lines. Since this post did not run npm, it does not show whether your npm version warns or stops with ERESOLVE in that case. Either way, plan on pinning nodemailer 8 or 7 and SimpleWebAuthn 9 if you use those providers.

Who Actually Runs the Beta? Downloads by Version

npm publishes download counts per version for the last seven days. Here are both packages, then the busiest next-auth versions:

curl -s https://api.npmjs.org/downloads/point/last-week/next-auth
curl -s https://api.npmjs.org/downloads/point/last-week/better-auth
curl -s https://api.npmjs.org/versions/next-auth/last-week | grep -oE '"(4\.24\.1[1-5]|5\.0\.0-beta\.(25|29|3[0-2]))":[0-9]+'
{"downloads":8447108,"start":"2026-11-25","end":"2026-12-01","package":"next-auth"}
{"downloads":19255072,"start":"2026-11-25","end":"2026-12-01","package":"better-auth"}
"4.24.11":612982
"4.24.12":22006
"4.24.13":664119
"4.24.14":209180
"4.24.15":2474700
"5.0.0-beta.25":97044
"5.0.0-beta.29":40859
"5.0.0-beta.30":361941
"5.0.0-beta.31":352795
"5.0.0-beta.32":3379509

Summed across all 727 published versions (the full list is in the raw data file), v5 betas took 4,283,259 downloads, or 50.7%. All v4 versions took 4,152,798 (49.2%), and v3 and older the remaining 0.1%. In other words, the beta now edges out the stable line by a hair, and the single most downloaded version is 5.0.0-beta.32.

Two caveats apply. First, a download is not an install. CI pipelines, Docker builds and registry mirrors each count separately, so these numbers measure build traffic, not projects. Second, Better Auth outdownloaded next-auth by 2.28 times in the same week. Its seven-day total first passed next-auth’s on 2026-07-06, by the daily range endpoint for both packages.

Which NextAuth Versions Have Open Advisories?

npm audit sends your installed versions to a bulk advisory endpoint. You can call it yourself. First, the two current versions:

curl -s -X POST -H 'Content-Type: application/json' \
  -d '{"next-auth":["4.24.15","5.0.0-beta.32"]}' \
  https://registry.npmjs.org/-/npm/v1/security/advisories/bulk
{}

An empty object means no known advisory. Then the release one step older on each line:

curl -s -X POST -H 'Content-Type: application/json' \
  -d '{"next-auth":["4.24.14","5.0.0-beta.31"]}' \
  https://registry.npmjs.org/-/npm/v1/security/advisories/bulk \
  | grep -oE '"(url|severity|vulnerable_versions)":"[^"]+"'
"url":"https://github.com/advisories/GHSA-8fpg-xm3f-6cx3"
"severity":"critical"
"vulnerable_versions":">=5.0.0-beta.0 <=5.0.0-beta.31"
"url":"https://github.com/advisories/GHSA-7rqj-j65f-68wh"
"severity":"critical"
"vulnerable_versions":">=5.0.0-beta.1 <=5.0.0-beta.31"
"url":"https://github.com/advisories/GHSA-7rqj-j65f-68wh"
"severity":"critical"
"vulnerable_versions":">=4.10.3 <4.24.15"
"url":"https://github.com/advisories/GHSA-xmf8-cvqr-rfgj"
"severity":"high"
"vulnerable_versions":">=4.0.6 <=4.24.14"
"url":"https://github.com/advisories/GHSA-xmf8-cvqr-rfgj"
"severity":"high"
"vulnerable_versions":">=5.0.0-beta.0 <=5.0.0-beta.31"
"url":"https://github.com/advisories/GHSA-x445-f3h2-j279"
"severity":"moderate"
"vulnerable_versions":"<=4.24.14"
"url":"https://github.com/advisories/GHSA-x445-f3h2-j279"
"severity":"moderate"
"vulnerable_versions":">=5.0.0-beta.1 <=5.0.0-beta.31"

Four advisories were published on GitHub on 2026-07-23, three days after the fixed releases:

AdvisorySeverityWhat goes wrongFixed in
GHSA-8fpg-xm3f-6cx3 (CVE-2026-73421)CriticalA config error makes auth a truthy error object, so existence checks pass for everyonebeta.32 (v5 only)
GHSA-7rqj-j65f-68wh (CVE-2026-73420)CriticalEmail sign-in validates before Unicode normalization, so a homoglyph @ can redirect a magic link4.24.15, beta.32
GHSA-xmf8-cvqr-rfgj (CVE-2026-73418)HighgetToken() throws on a malformed Bearer header4.24.15, beta.32
GHSA-x445-f3h2-j279 (CVE-2026-73419)ModerateOAuth state, nonce and PKCE cookies are not bound to their provider4.24.15, beta.32

Every version except 4.24.15 and 5.0.0-beta.32 falls inside at least one of these ranges or an older one. By the per-version counts above, that is 2,592,899 downloads last week (30.7%) on versions with an open advisory. Of those, 903,750 went to v5 betas that still have the fail-open bug. One more detail: the getToken() advisory text says v5 is affected up to beta.25, while its structured range says up to beta.31. npm audit uses the structured range, so it flags the wider set.

The Fail-Open Bug in Existence Checks

GHSA-8fpg matters most because it hits the pattern the docs teach. According to the advisory, when the Auth.js configuration fails on the server, for example because AUTH_SECRET disappeared in a deploy, the auth object becomes { message: "There was a problem with the server configuration..." } instead of null. Any check of the form !!auth then passes for every visitor.

The official protecting resources guide still shows that pattern; its source was last edited on 2026-02-07, before the advisory:

// auth.ts, as shown in the Auth.js guide: fails open on beta.31 and older
import NextAuth from "next-auth"

export const { auth, handlers } = NextAuth({
  callbacks: {
    authorized: async ({ auth }) => {
      // Logged in users are authenticated, otherwise redirect to login page
      return !!auth
    },
  },
})

On beta.32 the fix makes a configuration error fail closed, so this exact code is safe there. However, the type for auth says Session | null, and on older betas the runtime value was neither. Checking a field that only a real session carries protects you on every version, and also survives a future regression:

// auth.ts: checks for a real user, not a truthy object
import NextAuth from "next-auth"
import GitHub from "next-auth/providers/github"

export const { handlers, auth, signIn, signOut } = NextAuth({
  providers: [GitHub], // reads AUTH_GITHUB_ID and AUTH_GITHUB_SECRET
  session: { strategy: "jwt" },
  callbacks: {
    authorized({ auth }) {
      // An error object has no user, so this fails closed on every beta
      return Boolean(auth?.user)
    },
  },
})

The same rule applies inside a wrapped route or proxy. Test req.auth?.user, never req.auth alone.

Why v5 Code Breaks on the v4 Package

Most 2026 tutorials, including our own walkthrough of authentication in Next.js with NextAuth.js, use the v5 setup: one auth.ts that exports handlers and auth. Run that against what npm install next-auth gives you and it fails. The tarballs show why. Here is the default export in each:

curl -s https://registry.npmjs.org/next-auth/-/next-auth-4.24.15.tgz | tar xzO package/next/index.d.ts | grep -n 'function NextAuth'
curl -s https://registry.npmjs.org/next-auth/-/next-auth-5.0.0-beta.32.tgz | tar xzO package/index.d.ts | grep -n 'export default function NextAuth'
10:declare function NextAuth(options: AuthOptions): any;
11:declare function NextAuth(req: NextApiRequest, res: NextApiResponse, options: AuthOptions): any;
12:declare function NextAuth(req: NextRequest, res: RouteHandlerContext, options: AuthOptions): any;
323:export default function NextAuth(config: NextAuthConfig | ((request: NextRequest | undefined) => Awaitable<NextAuthConfig>)): NextAuthResult;

In v4, NextAuth(options) is typed any, and its runtime code in next/index.js returns a single route handler function. Consequently, TypeScript accepts const { handlers, auth } = NextAuth(...) without complaint, and both names come out undefined. The first failure arrives at runtime, typically when app/api/auth/[...nextauth]/route.ts tries to read GET and POST from handlers. This post derived that from the published code; it did not run a Next.js app. Still, the fix is clear: if your code imports auth from your own auth.ts, you need next-auth@beta, not next-auth.

Is NextAuth Still Maintained? Auth.js and Better Auth

The project’s own README answers this, on the main branch as read on 2026-12-03:

Auth js is now part of Better Auth. We recommend new projects to start with Better Auth unless there are some very specific feature gaps (most notably stateless session management without a database).

The announcement on the Better Auth blog is dated September 22, 2025. It says the Better Auth team now maintains Auth.js and that existing users “can continue doing so without disruption—we’ll keep addressing security patches and urgent issues as they come up.” The July 2026 releases match that promise: four advisories fixed on both lines in one day, and no feature work since.

That gives a clear reading of the NextAuth v5 beta. It is maintained for security, it works with current Next.js, and its owners steer new projects elsewhere. The one capability they name as missing from Better Auth, stateless JWT sessions without a database, is also the main reason to stay. If you want background on that trade-off, our explainer on OAuth2, JWT and session tokens covers what a database session buys you.

How to Install the NextAuth v5 Beta Safely

If you decide to use the beta, these steps keep the version under your control:

  1. Install the exact version, not the tag: npm install next-auth@5.0.0-beta.32 --save-exact. A tag moves when the maintainers publish; an exact pin moves only when you change it.
  2. Commit the lockfile, and let your CI install with npm ci so every build gets the same tree.
  3. On Next.js 16, put route protection in proxy.ts. The Next.js proxy docs list middleware as deprecated and renamed in v16.0.0, and the Auth.js guide now uses export { auth as proxy }.
  4. Check auth?.user in every authorized callback, proxy and wrapped route handler, as shown above.
  5. Run npm audit --omit=dev in CI and fail the build on high or critical findings. Our guide to dependency vulnerability scanning with Snyk and Dependabot covers wiring that into a pipeline.
  6. Fail the deploy when the server logs [auth][error], as the GHSA-8fpg advisory suggests, so a missing secret never reaches users quietly.

Step 3 in code, with the user check from step 4:

// proxy.ts (Next.js 16): redirect anonymous visitors away from /dashboard
import { NextResponse } from "next/server"
import { auth } from "@/auth"

export const proxy = auth((req) => {
  const isLoggedIn = Boolean(req.auth?.user)
  const isProtected = req.nextUrl.pathname.startsWith("/dashboard")

  if (isProtected && !isLoggedIn) {
    const loginUrl = new URL("/login", req.nextUrl.origin)
    loginUrl.searchParams.set("callbackUrl", req.nextUrl.pathname)
    return NextResponse.redirect(loginUrl)
  }
})

export const config = {
  // Skip static assets and the auth API itself
  matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],
}

Why the callback URL: without it, users land on the home page after signing in and have to find their way back. The matcher keeps the proxy off static files, which matters because it runs on every matched request. One honest limit applies: this PC has no Node.js, so neither sample was compiled here. Instead, their signatures were checked against lib/index.d.ts in the beta.32 tarball, where authorized receives auth: Session | null and the wrapped request is a NextAuthRequest with auth: Session | null. If you are still on Next.js 15, the same file is middleware.ts exporting middleware; our post on Next.js 16 async request APIs covers the other breaking changes in that upgrade.

Real-World Scenario: A Removed Secret Opens Every Route

Consider a small team running a mid-sized App Router SaaS on next-auth@beta, installed sometime in 2025, with a ^5.0.0-beta.25 range and a lockfile that has not moved since. During a routine infrastructure change over a weekend, someone renames the secret store entry, and AUTH_SECRET arrives empty in production. On beta.25, Auth.js logs a configuration error, and the authorized callback copied from the docs keeps returning true. Every dashboard route now opens for anonymous visitors, and nothing in the uptime checks notices, because every page returns 200.

The fix is small, but the trade-off is real. Updating to beta.32 closes this particular hole, and the caret range already allows it, since ^5.0.0-beta.25 matches later betas of 5.0.0. However, the team is still on a prerelease with no stable date, owned by a vendor that recommends migrating. The cheap insurance lands in an afternoon: the version bump, auth?.user checks, and a deploy gate on [auth][error]. A move to Better Auth is the larger, separate decision, and it deserves its own sprint rather than a weekend hotfix.

When to Use the NextAuth v5 Beta

  • Your App Router app already runs on it and works, and you can pin 5.0.0-beta.32 exactly
  • You need stateless JWT sessions with no database, the one gap Better Auth’s own maintainers name
  • Your providers are OAuth or credentials, so the nodemailer and SimpleWebAuthn peer ranges do not affect you
  • You can own the risk of a prerelease that receives security patches but no new features

When NOT to Use the NextAuth v5 Beta

  • You are starting a new project in December 2026; the maintainers themselves point new work to Better Auth
  • Your stable v4 app on the Pages Router works today; moving to a beta trades a supported line for an unsupported API surface
  • You need passkeys with current SimpleWebAuthn, since the beta declares only ^9
  • Your security review forbids prerelease dependencies in production, which a beta always is

Common Mistakes with the NextAuth v5 Beta

  • Running npm install next-auth and then pasting v5 code; the install gives you 4.24.15
  • Guessing next-auth@next, which installs a v4 prerelease from 2021
  • Writing !!auth or if (req.auth) as the only access check instead of testing auth?.user
  • Leaving a lockfile on beta.31 or older; 903,750 downloads last week still pulled one of those
  • Treating a valid session as authorization; a session proves identity, and roles need their own check
  • Keeping middleware.ts on Next.js 16 without noticing the deprecation; plan the rename to proxy.ts

What This Post Did Not Test

This post read registries, advisories and source files. It did not run npm install, start a Next.js app, or reproduce any advisory. Therefore the peer-range table says what each package declares, not how a given npm version reacts to a mismatch. The runtime failure of v5 code on v4 is derived from the shipped next/index.js, not observed. The download counts include CI and mirror traffic and should not be read as project counts. Finally, Better Auth itself was not evaluated here beyond its download numbers; a migration needs its own comparison. For the broader picture of what to check in any auth library, our API security checklist for production is a reasonable starting list.

Conclusion

The NextAuth v5 beta is the version most tutorials teach, the most downloaded single next-auth release, and still not what npm install next-auth installs. On 2026-12-03, latest is 4.24.15 and beta is 5.0.0-beta.32. Both accept Next.js 16.5, both are patched against the July 2026 advisories, and neither has had a release since. Today, pin next-auth@5.0.0-beta.32 exactly if you stay, replace every bare !!auth with an auth?.user check, and add npm audit to CI. Then put a Better Auth evaluation on the roadmap, since that is where the maintainers say the project is heading. These registry reads are dated, so this post gets re-read every three months, or sooner if a v5 stable ships.