Loading…

WeChat Mini ProgramLogin

First, you need to use the login api of `WeChat Mini Program` to obtain the temporary `code` of the current user, and then use the code to log in: ["WeChat Mini Program login api instructions"](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html) After getting the `code`, complete the login: ```javascript WXAPI.login_wx(code) ``` + code The user temporary code of WeChat Mini Program obtained in the previous step ```json { "code": 0, "data": { "uid": 1351478, "openid": "om3AQ0YaRp3RZtFuZ1Wgk0OdQjvA", "mobile": "1860000062", "token": "83065b5e-9a75-4e64-8692-4f03eaa90348" }, "msg": "success" } ``` + uid After successful login, return the user number + openid is the openid of the current WeChat user corresponding to the current mini program + mobile is the current user’s mobile phone number + token is the token returned after the user logs in. Many subsequent user-related operations require the token to be operated.