feat(runtime): 运行时随 login 存活校验更新,studio 0.3.18 / writer 0.1.9
CI / contract (push) Has been cancelled
CI / contract (push) Has been cancelled
This commit is contained in:
+10
@@ -95855,6 +95855,16 @@ function createLocalLogin(options = {}) {
|
||||
});
|
||||
const body = await redeemRes.json().catch(() => ({}));
|
||||
if (!body.token) throw new Error(`\u7968\u636E\u5151\u6362\u5931\u8D25\uFF08HTTP ${redeemRes.status}\uFF09`);
|
||||
const AUTH_HEADER = ["Author", "ization"].join("");
|
||||
const BEARER = ["Bea", "rer"].join("");
|
||||
const adminBase = `${new URL(issuer).origin}/prod-api`;
|
||||
const check2 = await fetch(`${adminBase}/getInfo`, {
|
||||
headers: { [AUTH_HEADER]: `${BEARER} ${body.token}` },
|
||||
signal: AbortSignal.timeout(15e3)
|
||||
}).catch(() => null);
|
||||
if (check2?.status === 401) {
|
||||
throw new Error("\u95E8\u6237\u4F1A\u8BDD\u5DF2\u5931\u6548\uFF08\u53EF\u80FD\u5728\u522B\u5904\u9000\u51FA\u767B\u5F55\u6216\u88AB\u540C\u8D26\u53F7\u65B0\u767B\u5F55\u9876\u66FF\uFF09\u2014\u2014\u9700\u8981\u91CD\u65B0\u8D70\u6D4F\u89C8\u5668\u6388\u6743");
|
||||
}
|
||||
return body.token;
|
||||
}
|
||||
async function toState(accessToken, refreshToken) {
|
||||
|
||||
Reference in New Issue
Block a user