feat(auth): 实现全自动无感续杯 (401/即将过期自动重试换票) 与企业多身份唯一标识分层

This commit is contained in:
gitea committed 2026-08-27 11:04:41 +08:00
1 parent 189415cdac
commit b7a3bf2c03
7 files changed
+122 -17

No files matched your search

+7 -3
View File
@@ -80,15 +80,18 @@ export async function getPiperClient(
});
}
const corpId = corp.corpId || corp.credentials.corpId;
const staffId = corp.staffId || corp.credentials.staffId;
// 重新换取
const hoseToken = await fetchHoseToken(
corp.credentials.accessToken,
corp.credentials.corpId
corpId
);
const easoJwt = await fetchEasoJwt(
corp.credentials.accessToken,
corp.credentials.corpId,
corp.credentials.staffId
corpId,
staffId
);
const entry = {
@@ -104,6 +107,7 @@ export async function getPiperClient(
getHeaders: () => ({
Authorization: `Bearer ${easoJwt}`,
platformid: platformId,
hoseaccesstoken: hoseToken,
}),
onUnauthorized: () => {
piperMemoryCache.delete(cacheKey);