Skip to content

Send credentials on authed requests so login persists in dev - #298

Open
jenul-ferdinand wants to merge 2 commits into
mainfrom
fix-dev-session-credentials
Open

Send credentials on authed requests so login persists in dev#298
jenul-ferdinand wants to merge 2 commits into
mainfrom
fix-dev-session-credentials

Conversation

@jenul-ferdinand

Copy link
Copy Markdown
Member

What

  • In local dev the frontend (localhost:4200) and API (localhost:8080) are different origins, so the browser only attaches auth cookies to requests that set withCredentials.
  • Three authed requests omitted it: getByUser, me, and updateUsername.
  • This adds withCredentials: true to all three, matching the per-call convention the other services already use.

Why it logged you out

  • The notifications popup calls getByUser the moment login populates currentUser$.
  • In dev that request carried no cookie and returned 401.
  • The auth interceptor refreshed, retried without credentials, hit another 401, and its catchError ran clearSession(), dropping the user right after login.

Why prod was unaffected

  • Prod serves the API same-origin (relative /api/v2), so cookies ride along without the flag. The gap only shows on dev's cross-origin setup.

Tests

  • New assertions that getByUser, me, and updateUsername each send withCredentials. They fail without the fix.

Closes #297

Copilot AI review requested due to automatic review settings July 14, 2026 01:29
@jenul-ferdinand jenul-ferdinand added bug Something isn't working frontend priority: medium Normal priority. Pick up after high-priority items are clear. labels Jul 14, 2026
@jenul-ferdinand jenul-ferdinand self-assigned this Jul 14, 2026
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
monstar Ready Ready Preview, Comment Jul 14, 2026 1:29am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend priority: medium Normal priority. Pick up after high-priority items are clear.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login session doesn't persist in local dev

2 participants