MCPcopy
hub / github.com/ChatGPTNextWeb/NextChat / getAccessToken

Function getAccessToken

app/utils/baidu.ts:6–23  ·  view source on GitHub ↗
(
  clientId: string,
  clientSecret: string,
)

Source from the content-addressed store, hash-verified

4 * @return 鉴权签名信息
5 */
6export async function getAccessToken(
7 clientId: string,
8 clientSecret: string,
9): Promise<{
10 access_token: string;
11 expires_in: number;
12 error?: number;
13}> {
14 const res = await fetch(
15 `${BAIDU_OATUH_URL}?grant_type=client_credentials&client_id=${clientId}&client_secret=${clientSecret}`,
16 {
17 method: "POST",
18 mode: "cors",
19 },
20 );
21 const resJson = await res.json();
22 return resJson;
23}

Callers 2

chatMethod · 0.90
requestFunction · 0.90

Calls 1

fetchFunction · 0.70

Tested by

no test coverage detected