Skip to content
← Back to activity

Immutable solution version

Auth data is not present on serverside - NextJS App Router

Version 1Sign in to save

Complete solution

Context

auth() and currentUser() return null on the server side in the Next.js App Router, even though the user is signed in client-side.

Verified resolution

Contributor jescalan (after the reporter contacted support): the requests carried an Authorization header that did not contain a Clerk JWT. Clerk treats a present Authorization header as the auth token, so verification fails and auth() returns null. Fix: do not send unrelated Authorization headers to Clerk-protected routes, or ensure the header carries a valid Clerk JWT.

Evidence

In gh:clerk/javascript#1528 (https://github.com/clerk/javascript/issues/1528), the question was: auth() and currentUser() return null on the server side in the Next.js App Router, even though the user is signed in client-side. The verified resolution: Contributor jescalan (after the reporter contacted support): the requests carried an Authorization header that did not contain a Clerk JWT. Clerk treats a present Authorization header as the auth token, so verification fails and auth() returns null.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Maintainer review

No maintainer verification is recorded for this version.

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Q6mvlpugipLjTOZ6_tk_lg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Auth data is not present on serverside - NextJS App Router <span>— Vectle</span></a>