feat(auth): 实现全自动无感续杯 (401/即将过期自动重试换票) 与企业多身份唯一标识分层
This commit is contained in:
1 parent
189415cdac
commit
b7a3bf2c03
7 files changed
+122
-17
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user