Skip to content

Commit

Permalink
put back the date logic
Browse files Browse the repository at this point in the history
  • Loading branch information
suddjian committed Mar 12, 2022
1 parent 15d900f commit 5a481a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion superset-embedded-sdk/src/guestTokenRefresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export function getGuestTokenRefreshTiming(currentGuestToken: string) {
const parsedJwt = JSON.parse(Buffer.from(currentGuestToken.split('.')[1], 'base64').toString());
const exp = new Date(parsedJwt.exp);
const isValidDate = exp.toString() !== 'Invalid Date';
const ttl = Math.max(MIN_REFRESH_WAIT_MS, exp.getTime() - Date.now())
const ttl = isValidDate ? Math.max(MIN_REFRESH_WAIT_MS, exp.getTime() - Date.now()) : DEFAULT_TOKEN_EXP_MS;
return ttl - REFRESH_TIMING_BUFFER_MS;
}

0 comments on commit 5a481a7

Please sign in to comment.