Skip to content

Commit

Permalink
fix: Cookies must be strings
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Jan 9, 2024
1 parent 1814554 commit 1eec237
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api.planx.uk/modules/auth/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ function setJWTCookie(returnTo: string, res: Response, req: Request) {
res.cookie("jwt", req.user!.jwt, httpOnlyCookieOptions);

// Set second cookie which can be read by browser to detect presence of the unreadable httpOnly cookie
res.cookie("auth", { loggedIn: true }, defaultCookieOptions);
const authCookie = btoa(JSON.stringify({ loggedIn: true }));
res.cookie("auth", authCookie, defaultCookieOptions);

res.redirect(returnTo);
}
Expand Down

0 comments on commit 1eec237

Please sign in to comment.