Skip to content

Commit

Permalink
Fix access token expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
SanterreJo committed Nov 16, 2024
1 parent 398b557 commit bdc43bc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/hiloApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ export async function negotiate() {

export const getWsAccessToken = () => wsAccessToken || "";

export async function setupAutoRefreshToken(expiresIn: number | undefined) {
if (!expiresIn) {
export async function setupAutoRefreshToken(
expiresInSeconds: number | undefined
) {
if (!expiresInSeconds) {
getLogger().debug("Refreshing token");
try {
await refreshTokenRequest();
Expand All @@ -129,7 +131,7 @@ export async function setupAutoRefreshToken(expiresIn: number | undefined) {
unableToLogin(e);
}
}
}, expiresIn * 1000 - 1000 * 60 * 5); // 5 minutes before expiration
}, expiresInSeconds / 60 - 5); // 5 minutes before expiration
}
}

Expand Down

0 comments on commit bdc43bc

Please sign in to comment.