Either the result of cookies() from next/headers,
or any plain { name: value } map. Adapters with a get(name) method
are detected automatically.
{ clientId, storageKey? }. storageKey defaults to the
library's built-in prefix — only set it when you customized
storageKey in createClient.
The decoded Session or null when the cookie is absent
or malformed.
// app/page.tsx
import { cookies } from 'next/headers'
import { getSessionFromCookies } from '@faable/auth-js'
export default async function Page() {
const session = getSessionFromCookies(cookies(), {
clientId: '<client_id>'
})
if (!session) return <SignIn />
return <Dashboard user={session.user} />
}
Reads the persisted session from cookies on the server.
Pair this with the cookie storage adapter on the client: when the browser stores its session under the cookie shared with the server, the same
clientIdlets the server reconstruct it. Mirrors how the browser adapter builds the storage key and reassembles chunked cookies, so no extra wiring is required.