Next.js
Server sessions for the Next.js App Router.
import { … } from "@monarcode/session-kit/next";Guide: Next.js.
Functions
nextJar
The CookieJar for cookies() from next/headers, to pass to serverAuth from @monarcode/session-kit/server.
proxyJar
The CookieJar for a request in Next's Proxy (proxy.ts). It reads request's cookies and sets new ones on response. Use it with serverAuth.refreshIfDue, so the pages that render the request see a fresh token through nextJar.
Types
NextCookies
A request's cookie store, as cookies() from next/headers resolves it. nextJar reads and writes it, and Next's own store fits.
NextJarOptions
Options for nextJar.
Prop
Type
ProxyRequest
The request proxyJar reads cookies from. A NextRequest fits.
ProxyResponse
The response proxyJar sets cookies on. A NextResponse fits.