| 121 | } |
| 122 | |
| 123 | async jscode2session(code) { |
| 124 | const path = "/api-gw/oauthserver/applet/v1/jscode2session"; |
| 125 | let options = { |
| 126 | method: "POST", |
| 127 | url: API_HOST + path, |
| 128 | path, |
| 129 | isSign256: true, |
| 130 | isHeaderDelToken: true, |
| 131 | data: { code }, |
| 132 | }; |
| 133 | const { data: result } = await this.request(options); |
| 134 | if (result?.retCode !== "00000" && result?.code !== 200 && !result?.success) { |
| 135 | throw new Error(result?.retInfo || result?.message || JSON.stringify(result)); |
| 136 | } |
| 137 | return result?.data?.tokenInfo || result?.data || {}; |
| 138 | } |
| 139 | |
| 140 | async queryUserInfo(accountToken) { |
| 141 | const path = "/api-gw/oauthserver/applet/v1/userinfo/query"; |