MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / loginByWxCode

Method loginByWxCode

wxapp/fej.js:182–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

180 }
181
182 async loginByWxCode() {
183 try {
184 const code = await this.getLoginCode();
185 const data = await this.request({
186 method: "POST",
187 path: "/wscshop/weapp/authorize.json",
188 skipToken: true,
189 data: {
190 appId: MINI_APP_ID,
191 clientId: CLIENT_ID,
192 clientSecret: CLIENT_SECRET,
193 grantType: GRANT_TYPE,
194 code,
195 },
196 });
197 this.applyToken(data);
198 this.userInfo = data || {};
199 this.saveCachedToken();
200 $.log(`账号[${this.index}] 登录成功: ${data.nick_name || ""} ${maskPhone(data.mobile) || ""}`);
201 } catch (e) {
202 $.log(`账号[${this.index}] 登录失败: ${e.message || e}`);
203 }
204 }
205
206 async checkToken() {
207 try {

Callers 1

runMethod · 0.95

Calls 6

getLoginCodeMethod · 0.95
requestMethod · 0.95
applyTokenMethod · 0.95
saveCachedTokenMethod · 0.95
maskPhoneFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected