Skip to content

Commit

Permalink
Reuse Access Token if within 30 minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
Step7750 committed Apr 20, 2024
1 parent af485e9 commit df0b80e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/alarms/access_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ interface AccessToken {
export async function getAccessToken(): Promise<string | null> {
// Do we have a fresh local copy?
const tokenData = await gStore.get<AccessToken>(StorageKey.ACCESS_TOKEN);
if (tokenData?.token && tokenData.updated_at > Date.now() - 60 * 60 * 1000) {
// Token refreshed within the last hour, we can re-use
if (tokenData?.token && tokenData.updated_at > Date.now() - 30 * 60 * 1000) {
// Token refreshed within the last 30 min, we can re-use
return tokenData.token;
}

Expand Down

0 comments on commit df0b80e

Please sign in to comment.