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

Method loginByWxCode

wxapp/hezj.js:109–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107 }
108
109 async loginByWxCode() {
110 try {
111 const code = await this.getLoginCode();
112 const tokenInfo = await this.jscode2session(code);
113 const accountToken = tokenInfo?.accountToken;
114 if (!accountToken) throw new Error(`登录响应未返回 accountToken: ${JSON.stringify(tokenInfo)}`);
115 await this.queryUserInfo(accountToken);
116 this.token = accountToken;
117 $.log(`账号[${this.index}] CODE登录成功: ${maskToken(this.token)}`);
118 } catch (e) {
119 $.log(`账号[${this.index}] CODE登录失败: ${e.message || e}`);
120 }
121 }
122
123 async jscode2session(code) {
124 const path = "/api-gw/oauthserver/applet/v1/jscode2session";

Callers 1

runMethod · 0.95

Calls 5

getLoginCodeMethod · 0.95
jscode2sessionMethod · 0.95
queryUserInfoMethod · 0.95
maskTokenFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected