MCPcopy
hub / github.com/parse-community/parse-server / getAccessTokenFromCode

Method getAccessTokenFromCode

src/Adapters/Auth/qq.js:87–109  ·  view source on GitHub ↗
(authData)

Source from the content-addressed store, hash-verified

85 }
86
87 async getAccessTokenFromCode(authData) {
88 const response = await fetch('https://graph.qq.com/oauth2.0/token', {
89 method: 'GET',
90 headers: {
91 'Content-Type': 'application/x-www-form-urlencoded',
92 },
93 body: new URLSearchParams({
94 grant_type: 'authorization_code',
95 client_id: this.clientId,
96 client_secret: this.clientSecret,
97 redirect_uri: authData.redirect_uri,
98 code: authData.code,
99 }).toString(),
100 });
101
102 if (!response.ok) {
103 throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'qq API request failed.');
104 }
105
106 const text = await response.text();
107 const data = this.parseResponseData(text);
108 return data.access_token;
109 }
110}
111
112export default new QqAdapter();

Callers

nothing calls this directly

Calls 3

toStringMethod · 0.80
parseResponseDataMethod · 0.80
fetchFunction · 0.50

Tested by

no test coverage detected