(authData)
| 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 | |
| 112 | export default new QqAdapter(); |
nothing calls this directly
no test coverage detected