CodePark/ questions / Auth & security
START PRACTICINGPRACTICE
Frontend question · Next.js › Auth & security

In Next.js 15, how do you read the session cookie in a Server Component?

import { cookies } from "next/headers";

export default async function Page() {
  const store = /* ? */;
  const token = store.get("session")?.value;
  return <Dashboard token={token} />;
}
await cookies()

await cookies() is correct. In Next.js 15, cookies(), headers() and draftMode() are async and return a Promise. The tempting plain cookies() is wrong because you would get the Promise, not the cookies. useCookies() is a hook and document.cookie needs the browser, and neither is available in Server Components.