Skip to content

Commit dadf6f1

Browse files
authored
fix: correct token expiry logic (#265) (#276)
1 parent 72275b6 commit dadf6f1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hooks/useConnectionDetails.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ export default function useConnectionDetails(appConfig: AppConfig) {
6464
if (!jwtPayload.exp) {
6565
return true;
6666
}
67-
const expiresAt = new Date(jwtPayload.exp - ONE_MINUTE_IN_MILLISECONDS);
67+
const expiresAt = new Date(jwtPayload.exp * 1000 - ONE_MINUTE_IN_MILLISECONDS);
6868

6969
const now = new Date();
70-
return expiresAt >= now;
70+
return expiresAt <= now;
7171
}, [connectionDetails?.participantToken]);
7272

7373
const existingOrRefreshConnectionDetails = useCallback(async () => {

0 commit comments

Comments
 (0)