MCPcopy Create free account
hub / github.com/context-space/context-space / createClient

Function createClient

web/src/lib/supabase/server.ts:5–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import { cookies } from "next/headers"
4
5export async function createClient() {
6 const cookieStore = await cookies()
7 return createServerClient(process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, {
8 cookies: {
9 getAll() {
10 return cookieStore.getAll()
11 },
12 setAll(cookiesToSet) {
13 try {
14 cookiesToSet.forEach(({ name, value, options }) => cookieStore.set(name, value, options))
15 } catch {
16 // The `setAll` method was called from a Server Component.
17 // This can be ignored if you have middleware refreshing
18 // user sessions.
19 }
20 },
21 },
22 })
23}
24
25export async function getServerToken() {
26 const supabase = await createClient()

Callers 6

LocaleLayoutFunction · 0.90
sendVerificationCodeFunction · 0.90
loginWithOAuthFunction · 0.90
loginAnonymouslyFunction · 0.90
sendMagicLinkActionFunction · 0.90
getServerTokenFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected