Skip to content
Discussion options

You must be logged in to vote

Recommended approach (Next.js + Supabase Auth)

  1. JWT handling (don’t manage manually)

Let Supabase Auth issue and rotate JWTs.

Use HTTP-only cookies via @supabase/auth-helpers-nextjs instead of localStorage.

Access tokens are short-lived; refresh happens automatically.

  1. Session management

Use Supabase’s server-side session helpers in:

middleware.ts (protect routes)

Server Components / Route Handlers (validate user)

Treat Supabase as the single source of truth for sessions.

Avoid custom session tables unless you need advanced analytics.

  1. Google OAuth

Enable Google provider in Supabase Auth.

Use PKCE flow (default in Supabase) for security.

Handle redirects through Supabase; Next.js only …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by advuman
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants