Skip to content

Commit 10ad814

Browse files
fix[faustwp-core]: (#2313) add security flags to removeCookie() (#2314)
* fix[faustwp-core]: (#2313) add security flags to removeCookie() removeCookie() expires the refresh token cookie with only the expires attribute, missing the path, sameSite, secure, and httpOnly flags that setCookie() uses when setting it. Without a matching path: '/', the browser may not delete the correct cookie on logout. Add the same security attributes used in setRefreshToken() so the browser correctly identifies and expires the target cookie. Closes #2313 * chore: add changeset for cookie removal fix --------- Co-authored-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
1 parent 3e54dd2 commit 10ad814

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

.changeset/cookie-removal-flags.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@faustwp/core": patch
3+
---
4+
5+
fix[faustwp-core]: add path, sameSite, secure, and httpOnly flags to removeCookie() to match setCookie() attributes

packages/faustwp-core/src/server/auth/cookie.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ export class Cookies {
7070
this.response?.setHeader(
7171
'Set-Cookie',
7272
cookie.serialize(key, '', {
73+
path: '/',
74+
sameSite: 'strict',
75+
secure: true,
76+
httpOnly: true,
7377
expires: new Date(0),
7478
}),
7579
);

0 commit comments

Comments
 (0)