on-internet
← Community

Why can’t my client-side Supabase auth read the session after middleware sets cookies in Next.js 16?

Stack Overflow ·

I’m using Next.js 16 (App Router) with Supabase SSR auth, and I’m stuck on a mismatch between server-side and client-side auth state. The server clearly knows the user is authenticated, but the browser client does not. Environment Next.js: 16.1.1 (App Router) React: 19.2.3 Supabase: @supabase/ssr ^0.8.0 @supabase/supabase-js ^2.89.0 Auth strategy: Supabase SSR (cookie-based) Client auth: createBrowserClient Cookies: httpOnly Same domain deployment What works correctly Middleware (server-side) Middleware detects the authenticated user and admin role correctly: { hasUser: true, userId: "0fb294d7

Comments

Sign in or sign up to comment and upvote.

No comments yet.