MCPcopy Create free account
hub / github.com/Hello-Application-XH/HelloGML / getTokenLiveStatus

Function getTokenLiveStatus

src/chat.ts:1100–1122  ·  view source on GitHub ↗
(refreshToken: string)

Source from the content-addressed store, hash-verified

1098}
1099
1100export async function getTokenLiveStatus(refreshToken: string) {
1101 const sign = await generateSign();
1102 try {
1103 const response = await fetch("https://chatglm.cn/chatglm/user-api/user/refresh", {
1104 method: "POST",
1105 headers: {
1106 Authorization: `Bearer ${refreshToken}`,
1107 Referer: "https://chatglm.cn/main/alltoolsdetail",
1108 "X-Device-Id": uuid(false),
1109 "X-Request-Id": uuid(false),
1110 "X-Sign": sign.sign,
1111 "X-Timestamp": sign.timestamp,
1112 "X-Nonce": sign.nonce,
1113 ...getHeaders(),
1114 "Content-Type": "application/json",
1115 },
1116 });
1117 const data = await checkResult(response, refreshToken);
1118 return !!data.result?.access_token;
1119 } catch {
1120 return false;
1121 }
1122}

Callers 2

handleTokenCheckFunction · 0.90
handleAdminTokenCheckFunction · 0.90

Calls 5

uuidFunction · 0.90
generateSignFunction · 0.85
fetchFunction · 0.85
getHeadersFunction · 0.85
checkResultFunction · 0.85

Tested by

no test coverage detected