From ebce27adff9342609053f2412197e936a9dbdc6c Mon Sep 17 00:00:00 2001 From: Mike de Bock <1261006+mikedebock@users.noreply.github.com> Date: Wed, 20 Sep 2023 16:14:57 +0200 Subject: [PATCH] fix: set expires property to accessToken cookies --- src/tokensource/cookies.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tokensource/cookies.ts b/src/tokensource/cookies.ts index c03dd6a..bea4c05 100644 --- a/src/tokensource/cookies.ts +++ b/src/tokensource/cookies.ts @@ -58,10 +58,12 @@ export class CookieTokenSource implements TokenSource { } setAccessToken(response: Response, token: string) { + const expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 365); this._setCookie(response, this.cookieNames.accessToken, token, { httpOnly: false, secure: this.options.secure, sameSite: this.options.sameSite, + expires: expiresAt, }); } @@ -84,10 +86,12 @@ export class CookieTokenSource implements TokenSource { } setFingerprint(response: Response, fingerprint: string) { + const expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 365); this._setCookie(response, this.cookieNames.accessTokenHash, fingerprint, { httpOnly: true, secure: this.options.secure, sameSite: this.options.sameSite, + expires: expiresAt, }); } }