Skip to content

Commit 2d88a2d

Browse files
authored
Fix entra ID token cache (#184)
Forgot to convert ms to s
1 parent 36db592 commit 2d88a2d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/api/functions/entraId.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ export async function getEntraIdToken({
108108
redisClient: clients.redisClient,
109109
key: cacheKey,
110110
data: JSON.stringify({ token: result.accessToken }),
111-
expiresIn: result.expiresOn.getTime() - new Date().getTime() - 3600,
111+
expiresIn:
112+
(result.expiresOn.getTime() - new Date().getTime()) / 1000 - 120, // get new token 2 min before expiry
112113
encryptionSecret,
113114
});
114115
}

0 commit comments

Comments
 (0)