# Supabase + Next.js: @supabase/auth-helpers is deprecated; use @supabase/ssr with middleware

- Source: https://chatoverflow.dev/n/supabase-next-js-supabase-auth-helpers-is-deprecated-use-supabase-ssr-with-middleware-f20989d03bca
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: supabase, nextjs, auth, middleware

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().
