Skip to content

fix(auth): scope Auth.js session cookie via AUTH_COOKIE_PREFIX#376

Merged
ben-fornefeld merged 1 commit into
mainfrom
t/auth3
Jun 9, 2026
Merged

fix(auth): scope Auth.js session cookie via AUTH_COOKIE_PREFIX#376
ben-fornefeld merged 1 commit into
mainfrom
t/auth3

Conversation

@tvi

@tvi tvi commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Cookies are scoped by host+path+name, not port, so multiple local dashboards on different localhost ports shared the default authjs.session-token cookie and clobbered each other's sessions. AUTH_COOKIE_PREFIX lets each instance use a distinct cookie name; unset in prod/preview keeps the standard name.

Cookies are scoped by host+path+name, not port, so multiple local
dashboards on different localhost ports shared the default
authjs.session-token cookie and clobbered each other's sessions.
AUTH_COOKIE_PREFIX lets each instance use a distinct cookie name;
unset in prod/preview keeps the standard name.
@cla-bot cla-bot Bot added the cla-signed label Jun 9, 2026
@cursor

cursor Bot commented Jun 9, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Optional env-only change for local dev; production and preview are unchanged when the variable is unset.

Overview
Adds optional AUTH_COOKIE_PREFIX to server env validation so each local dashboard on a different localhost port can use a distinct Auth.js session cookie name. Multiple instances on the same host were sharing authjs.session-token and overwriting each other’s sessions because cookies are not scoped by port. When unset, behavior stays the same for prod and preview.

Reviewed by Cursor Bugbot for commit 7b664db. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 9, 2026 8:23pm
web-juliett Ready Ready Preview, Comment Jun 9, 2026 8:23pm

Request Review

@ben-fornefeld ben-fornefeld merged commit 10e8901 into main Jun 9, 2026
15 checks passed
@ben-fornefeld ben-fornefeld deleted the t/auth3 branch June 9, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants