From df0b80eb0702d773509aebbd942d76020d993c43 Mon Sep 17 00:00:00 2001 From: Step7750 Date: Sat, 20 Apr 2024 14:32:03 -0600 Subject: [PATCH] Reuse Access Token if within 30 minutes --- src/lib/alarms/access_token.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/alarms/access_token.ts b/src/lib/alarms/access_token.ts index 4337ded0..b5995f70 100644 --- a/src/lib/alarms/access_token.ts +++ b/src/lib/alarms/access_token.ts @@ -9,8 +9,8 @@ interface AccessToken { export async function getAccessToken(): Promise { // Do we have a fresh local copy? const tokenData = await gStore.get(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; }