Skip to content

Commit

Permalink
fix: set expires property to accessToken cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedebock committed Sep 20, 2023
1 parent 64f0934 commit ebce27a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tokensource/cookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}

Expand All @@ -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,
});
}
}

0 comments on commit ebce27a

Please sign in to comment.