You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both src/pages/Login/Login.tsx and src/pages/Signup/Signup.tsx make API calls using axios without the withCredentials: true option:
// src/pages/Login/Login.tsxconstresponse=awaitaxios.post(`${backendUrl}/api/auth/login`,formData);// src/pages/Signup/Signup.tsx — comment says "Include cookies for session" but the option is absentconstresponse=awaitaxios.post(`${backendUrl}/api/auth/signup`,formData);
The backend uses express-session with cookie-based sessions (configured in backend/server.js). For a browser to store and send session cookies on cross-origin requests, the axios call must include withCredentials: true and the server must respond with Access-Control-Allow-Credentials: true.
Without withCredentials: true:
The Set-Cookie header in the login response is silently ignored by the browser.
No session cookie is stored.
Every subsequent request is treated as unauthenticated by the backend.
Root Cause
src/pages/Login/Login.tsx and src/pages/Signup/Signup.tsx do not pass { withCredentials: true } to axios. The comment in Signup.tsx ("Include cookies for session") confirms this was intended but never implemented.
Impact
Login is non-functional across page navigations. The user appears to log in (response is 200) but is immediately unauthenticated on any subsequent page load or API request.
The logout route at /api/auth/logout is also unreachable with a valid session because the cookie is never sent back.
Observe the login response headers: Set-Cookie is present in the response.
Navigate to any protected page.
Observe that no Cookie header is sent on subsequent requests — the session is lost.
Expected Behavior
After a successful login, the session cookie should be stored and sent with every subsequent request, maintaining the authenticated state across page navigations.
Description
Both
src/pages/Login/Login.tsxandsrc/pages/Signup/Signup.tsxmake API calls using axios without thewithCredentials: trueoption:The backend uses
express-sessionwith cookie-based sessions (configured inbackend/server.js). For a browser to store and send session cookies on cross-origin requests, the axios call must includewithCredentials: trueand the server must respond withAccess-Control-Allow-Credentials: true.Without
withCredentials: true:Set-Cookieheader in the login response is silently ignored by the browser.Root Cause
src/pages/Login/Login.tsxandsrc/pages/Signup/Signup.tsxdo not pass{ withCredentials: true }to axios. The comment inSignup.tsx("Include cookies for session") confirms this was intended but never implemented.Impact
/api/auth/logoutis also unreachable with a valid session because the cookie is never sent back.Steps to Reproduce
Set-Cookieis present in the response.Cookieheader is sent on subsequent requests — the session is lost.Expected Behavior
After a successful login, the session cookie should be stored and sent with every subsequent request, maintaining the authenticated state across page navigations.
Proposed Fix
Add
withCredentials: trueto both axios calls:Also ensure the backend CORS config allows credentials (replace
cors('*')with a specific origin andcredentials: trueas tracked in issue #374).Affected Files
src/pages/Login/Login.tsxsrc/pages/Signup/Signup.tsxbackend/server.js(CORS must also setcredentials: true)Suggested Labels
type:buglevel:advancedquality:exceptionalI would like to work on this issue under GSSoC 2026. Could you please assign it to me? @GitMetricsLab
/assign