Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/fathym_common/src/deno.deps.ts>DenoKVOAuth.getSessionId

The Fathym Reference Architecture provides the common foundation for applications built in Typescript.
Go to Latest
function DenoKVOAuth.getSessionId
Re-export
import { DenoKVOAuth } from "https://deno.land/x/fathym_common@v0.0.183/src/deno.deps.ts";
const { getSessionId } = DenoKVOAuth;

Gets the session ID from the cookie header of a request. This can be used to check whether the client is signed-in and whether the session ID was created on the server by checking if the return value is defined.

Examples

Example 1

import { getSessionId } from "https://deno.land/x/deno_kv_oauth@$VERSION/mod.ts";

export async function handler(request: Request) {
  const sessionId = await getSessionId(request);
  const hasSessionIdCookie = sessionId !== undefined;

  return Response.json({ sessionId, hasSessionIdCookie });
}

Parameters

request: Request
optional
options: GetSessionIdOptions

Returns

Promise<string | undefined>