Share sessions across subdomains with Supabase

Superfast one. If you have a Supabase app that has presences on multiple subdomains, eg. a marketing site at www and an app on app, you can share the session by setting the cookie domain where you instantiate the Supabase client.

const [supabase] = useState(() => createPagesBrowserClient({
    cookieOptions: {
        domain: COOKIE_DOMAIN,
        maxAge: 100000000,
        path: '/',
        sameSite: 'lax',
        secure: true,
    }
}));
Published October 05, 2023