diff --git a/packages/faustwp-core/src/server/auth/cookie.ts b/packages/faustwp-core/src/server/auth/cookie.ts index 6efeeb58e..bf9531982 100644 --- a/packages/faustwp-core/src/server/auth/cookie.ts +++ b/packages/faustwp-core/src/server/auth/cookie.ts @@ -99,22 +99,4 @@ export class Cookies { this.response?.setHeader('Set-Cookie', newCookies); } - - public removeCookie(key: string): void { - delete this.cookies[key]; - - const existingCookieHeader = this.response?.getHeader('Set-Cookie'); - - const newCookies = mergeCookies( - existingCookieHeader, - cookie.serialize(key, '', { - path: '/', - expires: new Date(0), - secure: true, - httpOnly: true, - }), - ); - - this.response?.setHeader('Set-Cookie', newCookies); - } } diff --git a/packages/faustwp-core/src/server/auth/token.ts b/packages/faustwp-core/src/server/auth/token.ts index e2661a15e..192f1f24b 100644 --- a/packages/faustwp-core/src/server/auth/token.ts +++ b/packages/faustwp-core/src/server/auth/token.ts @@ -40,7 +40,13 @@ export class OAuth { let expiresIn: Date | undefined; if (!isString(token) || token.length === 0) { - this.cookies.removeCookie(this.tokenKey); + this.cookies.setCookie(this.tokenKey, '', { + path: '/', + expires: new Date(0), + secure: true, + httpOnly: true, + }); + this.cookies.setCookie(this.hasTokenKey, '0', { path: '/', encoded: false,