# code2accessToken

本接口应在后端服务器调用

To check login credentials, acquire a temporary login credential code via the wx.login() interface, then pass it to the developer server and call the interface to complete the login process. See the Mini Program Login for more instructions.

# URL

GET https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code

# 请求Parameter

property type default value optional description version
appid string yes Mini Program appId
secret string yes Mini Program appSecret
js_code string yes The code acquired at login
grant_type string yes Authorization type. You only need to enter the authorization_code here

# Return

# Object

Returned JSON data package

property type description version
openid string User's unique identifier
session_key string Session key
uinionid string The unique identifier of a user on the Open Platform, which. returns when satisfying the requirements of UnionID issuing. For details, see UnionID Mechanism Explanation.
errcode number Error code
errMsg string Error message

errcode 's struct

value description
-1 System busy, the developer is requested to try again later
0 Request successful
40029 Code invalid