From bb414c7de688ac11e86364a9f7590eb55b430a5e Mon Sep 17 00:00:00 2001 From: sugoidogo Date: Sat, 18 Jan 2025 12:38:33 +0000 Subject: [PATCH] fallback to any user token instead of app token --- static/TwitchAuth-localforage.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/TwitchAuth-localforage.mjs b/static/TwitchAuth-localforage.mjs index 1adb803..3a4c3d8 100644 --- a/static/TwitchAuth-localforage.mjs +++ b/static/TwitchAuth-localforage.mjs @@ -189,8 +189,8 @@ export default class TwitchAuth { * get the cached token * @returns {Promise} */ - async getLocalToken(user_id=undefined){ - const data=await localStorage.getItem(user_id||this.client_id)||globalThis.localStorage.getItem(import.meta.url) + async getLocalToken(user_id=await localStorage.key(0)){ + const data=await localStorage.getItem(user_id)||globalThis.localStorage.getItem(import.meta.url) if(!data){ return null } @@ -198,7 +198,7 @@ export default class TwitchAuth { } async getAppToken(){ - let token=await this.getLocalToken() + let token=await this.getLocalToken(this.client_id) if(!token){ token=TwitchAuth.getAppToken(this.client_id) token=await this.setToken(token)