Skip to content

Commit

Permalink
fix: remove cookies from root domain
Browse files Browse the repository at this point in the history
  • Loading branch information
peterphanouvong committed Feb 9, 2024
1 parent cd3c65d commit 8d2a332
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/session/sessionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ export const pageRouterSessionManager = (req, res) => {
maxAge: -1
})
]);

// remove cookies from the root domain
res?.setHeader('Set-Cookie', [
cookie.serialize(itemKey, '', {
path: '/',
maxAge: -1
})
]);
},
destroySession: () => {
res?.setHeader('Set-Cookie', [
Expand All @@ -174,6 +182,24 @@ export const pageRouterSessionManager = (req, res) => {
})
)
]);

// remove cookies from the root domain
res?.setHeader('Set-Cookie', [
...[
'id_token_payload',
'id_token',
'access_token_payload',
'access_token',
'user',
'refresh_token',
'post_login_redirect_url'
].map((name) =>
cookie.serialize(name, '', {
path: '/',
maxAge: -1
})
)
]);
}
};
};

0 comments on commit 8d2a332

Please sign in to comment.