# Mini Program Login

Debugging tools

Interface should be called on the server side, seeHattori API

# Interface Dxplaination

# Interface name

thirdpartyCode2Session

# Functional description

# Note

  • This interface only supports the service provider to obtain the information of the Mini Program with the existing authorization relationship, and if the Mini Program has not been authorized to a third-party platform, there will be a 61003 error.

# Calling mode

# HTTPS call


GET https://api.weixin.qq.com/sns/component/jscode2session?component_access_token=ACCESS_TOKEN 

# Request parameters

attribute type Required Introductions
component_access_Token string yes Interface invokes the certificate, which is URL Parameters, non Body Parameters. usecomponent_access_Token
appid string yes Mini Program. AppID
grant_type string yes fill authorization_code
component_appid string yes Third-Party Platforms appid
js_code string yes wx.login Acquired code

# Return parameters

attribute type Introductions
session_key string Session key
openid string Uniquely identified by the user openid
Unions string User's unique identifier in the open platform, in meeting the UnionID Will return in the case of issued conditions, see UnionID Dxplaination of the mechanism

# Call Example

Example Dxplaination: Return to normal

# Sample Request Data


GET https://api.weixin.qq.com/sns/component/jscode2session?appid=APPID&js_code=JSCODE&grant_type=authorization_code&component_appid=COMPONENT_APPID&component_access_token=COMPONENT_ACCESS_TOKEN 

# Return Data Example


{
  "opens": "OPENID",
  "session_key": "SESSIONKEY",
  "unionid":"oHAUs6LSuwgHq-mlnFrffKXw3QYM"
}
 

# Error code

Error code Error code Solutions
45011 api minute-quota reach limit  mustslower  retry next minute API Call too often, please wait and try again
40029 code invalid js_Invalid code
61003 component is not authorized by this account
41021 missing component_access_Token