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

Function createClient

web/src/lib/supabase/client.ts:6–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4const supabaseLogger = clientLogger.withTag("supabase")
5
6export function createClient() {
7 const client = createBrowserClient(process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, {
8 auth: {
9 autoRefreshToken: true,
10 persistSession: true,
11 detectSessionInUrl: true,
12 storage: {
13 getItem: (key) => {
14 const value = localStorage.getItem(key)
15 return value
16 },
17 setItem: (key, value) => {
18 localStorage.setItem(key, value)
19 },
20 removeItem: (key) => {
21 localStorage.removeItem(key)
22 },
23 },
24 },
25 })
26
27 client.auth.onAuthStateChange((event, session) => {
28 supabaseLogger.info("Auth state changed", { event, session })
29 })
30
31 return client
32}
33
34export async function getClientToken() {
35 const supabase = createClient()

Callers 3

AuthProviderFunction · 0.90
AuthCallbackPageFunction · 0.90
getClientTokenFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected