@faable/auth-js - v1.7.4
    Preparing search index...

    Function getSessionFromCookies

    • 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 clientId lets the server reconstruct it. Mirrors how the browser adapter builds the storage key and reassembles chunked cookies, so no extra wiring is required.

      Parameters

      • cookiesStore: any

        Either the result of cookies() from next/headers, or any plain { name: value } map. Adapters with a get(name) method are detected automatically.

      • options: { clientId: string; storageKey?: string }

        { clientId, storageKey? }. storageKey defaults to the library's built-in prefix — only set it when you customized storageKey in createClient.

      Returns Session | null

      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} />
      }