Skip to content

Instantly share code, notes, and snippets.

@victory-sokolov
Created June 10, 2023 15:28
Show Gist options
  • Save victory-sokolov/40c92d061d685567b9180ef98aad88cb to your computer and use it in GitHub Desktop.
Save victory-sokolov/40c92d061d685567b9180ef98aad88cb to your computer and use it in GitHub Desktop.
Supabase snippets
import { cookies, headers } from 'next/headers';
import { createServerComponentSupabaseClient } from '@supabase/auth-helpers-nextjs';
const supabase = createServerComponentSupabaseClient({
supabaseUrl: process.env.NEXT_PUBLIC_SUPABASE_URL,
supabaseKey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
headers,
cookies
});
const {
data: { session }
} = await supabase.auth.getSession();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment