Skip to content

zibbie/minimal-supabase-ssr-nextjs-issue

Repository files navigation

Minimal Reproduction Case for Supabase SSR Auth Issue

This project demonstrates an issue with @supabase/ssr where supabase.auth.getUser() fails with AuthSessionMissingError in Next.js (v15.2.4 tested) API Routes, despite a valid authentication cookie being present.

Related GitHub Issue: [Link do Twojego zgłoszenia na GitHubie - wstawisz później]

Steps to Reproduce

  1. Clone this repository.
  2. Create a .env.local file based on .env.local.example with your Supabase project credentials.
  3. Run npm install.
  4. Run npm run dev.
  5. Open the application in your browser (e.g., http://localhost:3000/login) and log in with a valid user. You should be redirected to /dashboard.
  6. Open browser developer tools, find the sb-<YOUR_PROJECT_REF>-auth-token cookie, and copy its value (ensure it's cleaned, without base64- prefix or quotes).
  7. Open a terminal and run the following curl command (replace <PORT> and <PASTE_CLEANED_COOKIE_VALUE_HERE>):
    curl -X GET \
      -H "Cookie: sb-<YOUR_PROJECT_REF>-auth-token=<PASTE_CLEANED_COOKIE_VALUE_HERE>" \
      -v \
      http://localhost:<PORT>/api/test-auth
    
      Observe the curl output (shows 401 Unauthorized) and the server logs (npm run dev terminal shows AuthSessionMissingError).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published