Auth Session

Access the current Supabase session from any surface. The session is persisted with an MV3-compatible storage adapter — no cookies, no localStorage.

Check session on mount

import { auth } from "@/integrations/supabase";

const user = await auth.getUser();           // { id, email } | null
const signedIn = await auth.isAuthenticated();
const session = await auth.getSession();     // full token + user + expiry

Listen for changes

auth.onChange fires on sign-in, sign-out, and token refresh across all surfaces. Use it to show or hide authenticated UI without polling.

import { auth } from "@/integrations/supabase";

auth.onChange((session) => {
  if (session.isAuthenticated) showApp(); else showLogin();
});

Sign in and sign up

For the full auth API (sign-in, sign-up, OAuth, sign-out), see the Supabase Backend page.