May 19, 2021 WeChat Mini Program Development Document
This interface should be called on the server side, as detailed in the Service Side API.
The login credentials are verified. T he temporary login credential code is obtained through the wx.login interface and then passed to the developer server to call this interface to complete the login process. For more information on how to use, see Sign in to the small program.
GET https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code
Property | Type | The default | Required | Description |
---|---|---|---|---|
appid | string | Is | Small app Id | |
secret | string | Is | Small app Secret | |
js_code | string | Is | The code you get when you sign in | |
grant_type | string | Is | Authorization type, just fill in the authorization_code |
The returned JSON packet
Property | Type | Description |
---|---|---|
Openid | string | The user's unique identity |
session_key | string | The session key |
unionid | string | The user's unique identifier for the open platform is returned if the UnionID condition is met. |
errcode | number | Error code |
errmsg | string | The error message |
The legal value of errcode
Value | Description | The lowest version |
---|---|---|
-1 | The system is busy, so please try again later | |
0 | The request was successful | |
40029 | Code is not valid | |
45011 | Frequency limit, 100 times per user per minute |