Skip to content

Commit

Permalink
fix: Logout staging cookie, remove expires option on cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
filipw01 committed Mar 20, 2021
1 parent 7d54988 commit f2c4267
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/utils/setToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export async function setToken(token: string, setCookies: Array<Cookie>) {
value: token,
options: {
domain: SERVER_HOST,
expires: new Date(Date.now() + MILLISECONDS_IN_A_WEEK),
httpOnly: true,
maxAge: MILLISECONDS_IN_A_WEEK / 100,
path: "/",
Expand Down
5 changes: 3 additions & 2 deletions src/utils/unsetToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ export async function unsetToken(setCookies: Array<Cookie>) {
value: "",
options: {
domain: SERVER_HOST,
expires: new Date(Date.now()),
httpOnly: true,
// Set and max-age to unset the cookie in the browser
maxAge: 0,
path: "/",
sameSite: true,
// Disable sameSite to allow localhost development with staging backend
sameSite: STAGE === "staging" ? "none" : "strict",
secure: STAGE !== "dev",
},
});
Expand Down

0 comments on commit f2c4267

Please sign in to comment.