MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / getAccessToken

Function getAccessToken

wxapp/aima.js:181–199  ·  view source on GitHub ↗
(account)

Source from the content-addressed store, hash-verified

179}
180
181async function getAccessToken(account) {
182 const value = account.trim();
183 if (isToken(value)) {
184 $.log(`ℹ️ 检测到旧token变量,将直接使用: ${maskToken(value)}`);
185 return value;
186 }
187
188 const cache = readCache();
189 const cachedToken = cache[value]?.token;
190 if (cachedToken) {
191 $.log(`🔎 使用缓存token校验: ${maskToken(cachedToken)}`);
192 if (await validateToken(value, cachedToken)) {
193 $.log("✅ 缓存token有效");
194 return cachedToken;
195 }
196 }
197
198 return loginByCode(value);
199}
200
201// ================== 核心逻辑 ==================
202async function signIn(account, index) {

Callers 1

signInFunction · 0.85

Calls 6

isTokenFunction · 0.85
validateTokenFunction · 0.85
maskTokenFunction · 0.70
readCacheFunction · 0.70
loginByCodeFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected