Skip to content

Commit

Permalink
fix: convert token expire to ticks
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Aug 12, 2022
1 parent eadcff2 commit 3d1b807
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _src/react-app/hooks/useAuthentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ export default function useAuthentication() {
if (checkClaims(response.claims)) {
await initServiceWorker();
sendTokenToServiceWorker(response.token);
expireTime = response.expirationTime;
expireTime = new Date(response.expirationTime).getTime();

if (!window.Cypress) {
intervalId = setInterval(async () => {
if (Date.now() > expireTime) {
console.log('refreshing token');
const response = await result.user.getIdTokenResult();
expireTime = response.expirationTime;
expireTime = new Date(response.expirationTime).getTime();
sendTokenToServiceWorker(response.token);
}
}, config.authTokenCheckInterval);
Expand Down

0 comments on commit 3d1b807

Please sign in to comment.