()
| 4 | const supabaseLogger = clientLogger.withTag("supabase") |
| 5 | |
| 6 | export 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 | |
| 34 | export async function getClientToken() { |
| 35 | const supabase = createClient() |
no outgoing calls
no test coverage detected