Skip to content

Commit

Permalink
fix-expiration-of-token-from-actual-idtoken
Browse files Browse the repository at this point in the history
Signed-off-by: Vasile Negru <[email protected]>
Signed-off-by: Vasile Negru <[email protected]>
Signed-off-by: Vasile Negru <[email protected]>
Signed-off-by: Vasile Negru <[email protected]>
  • Loading branch information
Vasile Negru committed Aug 8, 2022
1 parent 913f917 commit 766a07e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/auth/types/openid/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function getExpirationDate(idToken: string | undefined) {
throw new Error('Invalid token');
} else {
const parts = idToken.split('.');
if (parts.length != 3) {
if (parts.length !== 3) {
throw new Error('Invalid token');
}
const claim = JSON.parse(Buffer.from(parts[1], 'base64').toString());
Expand Down
2 changes: 1 addition & 1 deletion server/auth/types/openid/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class OpenIdAuthRoutes {
);

// set to cookie
let expirationDate = tokenResponse.idToken
const expirationDate = tokenResponse.idToken
? getExpirationDate(tokenResponse.idToken)
: Date.now() + tokenResponse.expiresIn! * 1000;
const sessionStorage: SecuritySessionCookie = {
Expand Down

0 comments on commit 766a07e

Please sign in to comment.