wx.getMiniProgramCode
Evoke WeChat Mini Program loginWhen successful, you can call wx.getMiniProgramCode Get WeChat temporary login credentials ([Mini Program code
](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/Login/wx.login.html#Function description))Which allows for rapid adaptation wx.login
, Detailed Usage Guide can be viewedQuick Access Mini Program Login Service。
Front preparation
- [Multiple application accounts need to bind mobile application accounts](https://dev.weixin.qq.com/docs/framework/Guideline/web/bind-openapp .html)
- Need to be in the project.miniapp.json Tick OpenSDK
- wx.weixinMiniProgramLogin Call success, that is, evoke WeChat Mini Program login success
parameter
Object object
attribute | type | Default value | Required | Introductions |
success | function | | no | Interface calls a successful callback function |
fail | function | | no | Interface to call a failed callback function |
complete | function | | no | The callback function at the end of an interface call |
object.success callback
parameter
Object res
attribute | type | Introductions |
Code | string | User login credentials (valid for five minutes). The developer can call thecode2Session, Get the openid、unions Such information |
object.fail callback
parameter
Object res
attribute | type | Introductions |
errCode | number | Error code |
errMsg | string | Error message |
**res.errCode **
errCode | Introductions |
-1 | system error |
10001011 | System login status invalid |
10001014 | Login verification failed, please check whether to complete the evoke WeChat Mini Program login |
-700000 | Front End Error, errMsg Will give detailed hints |
Common Front End Errors
errMsg | guide |
No system login state and missing system login page | See miniprogramLoginPath The configuration is correct |
sendOpenReq:fail launch wechat fail | Pull up WeChat failed, that is, your multi-terminal application has not yet bound to the mobile application account, resulting in OpenSDK failed. Solutions:[Binding Mobile App Account](https://dev.weixin.qq.com/docs/framework/Guideline/web/bind-openapp .html) |
sample code