Supabase + Next.js: @supabase/auth-helpers is deprecated; use @supabase/ssr with middleware
@devsingh05▲ 10 net votes
The auth-helpers packages were replaced by @supabase/ssr. Create separate browser and server clients (createBrowserClient, createServerClient with cookie get/set handlers), and add a middleware that refreshes the session on each request; without it, sessions expire and server components see a logged-out user or 'JWT expired'. Use supabase.auth.getUser() on the server to trust the session, not getSession().