# Get the token
Interface should be called on the server side, seeHattori API。
# Interface Dxplaination
# Interface name
getComponentAccessToken
# Functional description
Token (component)_access_Token) is the calling credential for the third-party platform interface
# Note
- There is a limit to the acquisition of tokens. Each token is valid for 2 Hours, please manage the token by yourself, and when the token is about to expire (such as 1 hour and 50 minutes), re-call the interface to get it.
- Build a component_access_Token needs to rely on component_verify_ticket。 Can click to viewcomponent_verify_Details of the ticket
# Calling mode
# HTTPS call
POST https://api.weixin.qq.com/cgi-bin/component/api_component_Token
# Request parameters
attribute | type | Required | Introductions |
---|---|---|---|
component_appid | string | yes | Third-Party Platforms appid |
component_appsecret | string | yes | Third-Party Platforms appsecret |
component_verify_ticket | string | yes | WeChat backstage push ticket |
# Return parameters
attribute | type | Introductions |
---|---|---|
component_access_Token | string | Third-Party Platforms access_Token |
expires_in | number | Duration, in seconds |
# Call Example
Example Dxplaination: HTTPS requests
# Sample Request Data
{
"component_appid": "appid_value" ,
"component_appsecret": "appsecret_value",
"component_verify_ticket": "ticket_value"
}
# Return Data Example
{
"component_access_token": "61W3mEpU66027wgNZ_MhGHNQDHnFATkDa9-2llqrMBjUwxRSNPbVsMmyD-yq8wZETSoE5NQgecigDrSHkPtIYA",
"expires_in": 7200
}
# Error code
Error code | Error code | Solutions |
---|---|---|
-1 | system error | The system is busy, please wait for the developer to try again |
40001 | invalid credential access_Token isinvalid or not latest | Obtain access_Token time AppSecret Error, or access_Token Invalid. Please take the developer more seriously. AppSecret Of the correctness, or to see if you are working for the appropriate Official Account message template Call interface |
40013 | invalid appid | Illegal AppID , ask the developer to check AppID The correctness of the, avoid unusual characters, pay attention to the case |
61004 | access clientip is not registered | Third-party platform export IP is not set |
61005 | component ticket is expired | |
41004 | appsecret missing | lack secret parameter |
40125 | invalid appsecret view more at http://t.cn/RAEkdVq | Invalid appsecret |
61006 | component ticket is invalid | |
61011 | invalid component | |
45009 | reach max api daily quota limit | The call exceeded the day-level frequency limit. Callable clear_The quota interface restores the invocation quota. |
47001 | data format error | analysis JSON/XML Content errorpost Missing parameters in the dataCheck for corrections and try again. |
48001 | api unauthorized | api Function is not authorized, please confirm Official Account message template Have obtained the interface, can be in the public platform official website - View interface permissions in the Developer Center page |