Skip to content

Callback

The Supabase callback handles the authentication flow after users complete login through various providers (GitHub, Google, Discord, etc.). This endpoint processes the authentication tokens and establishes secure user sessions.

Supabase Auth Features

  • JWT token validation via Supabase Auth
  • Automatic session management
  • Row Level Security (RLS) integration
  • Built-in PKCE flow protection

Provider Support

  • GitHub OAuth integration
  • Google OAuth integration
  • Discord OAuth integration
  • Magic link authentication

Session Handling

  • Automatic token refresh
  • Server-side session validation
  • Cookie-based persistence
  • Secure httpOnly cookies

Supabase Integration

  • Direct user profile creation
  • Automatic user metadata sync
  • Real-time subscription setup
  • Database trigger activation

Configure these environment variables for Supabase authentication:

  • PUBLIC_SUPABASE_URL - Your Supabase project URL
  • PUBLIC_SUPABASE_ANON_KEY - Your Supabase anon/public key
  • SUPABASE_SERVICE_KEY - Your Supabase service role key (server-side only)
  • SUPABASE_JWT_SECRET - JWT secret for token verification
  1. Provider Authentication: User completes OAuth with GitHub/Google/Discord
  2. Supabase Redirect: Provider redirects to your Supabase callback URL
  3. Token Processing: Supabase Auth exchanges code for access/refresh tokens
  4. User Creation: Supabase automatically creates user record in auth.users
  5. Session Establishment: Client receives session with JWT tokens
  6. Profile Sync: User metadata synced to your profiles table via triggers