MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / getSessionFromCookie

Function getSessionFromCookie

lib/edge-runtime/utils.ts:411–429  ·  view source on GitHub ↗
(
  req: NextRequest,
  res?: NextResponse,
)

Source from the content-addressed store, hash-verified

409}
410
411export async function getSessionFromCookie(
412 req: NextRequest,
413 res?: NextResponse,
414): Promise<
415 | {
416 session: Session | null;
417 supabase: SupabaseClient<Database>;
418 }
419 | { session: null; supabase: null }
420> {
421 const cookie = req.headers.get("cookie");
422 if (!cookie) return { session: null, supabase: null };
423 res = res || NextResponse.next();
424 const supabase = createMiddlewareSupabaseClient<Database>({ req, res });
425 const {
426 data: { session },
427 } = await supabase.auth.getSession();
428 return { session, supabase };
429}

Callers 9

handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected