# 获取授权账号调用令牌

调试诊断

接口应在服务器端调用,不可在前端(小程序、网页、APP等)直接调用,具体可参考接口调用指南

接口英文名:getAuthorizerAccessToken

该接口用于获取授权账号的authorizer_access_token。authorizer_access_token 有效期为 2 小时,authorizer_access_token 失效时,可以使用 authorizer_refresh_token 获取新的 authorizer_access_token。使用过程中如遇到问题,可在开放平台服务商专区发帖交流。

# 1. 调用方式

# HTTPS 调用

POST https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token?access_token=ACCESS_TOKEN

# 云调用

  • 本接口不支持云调用

# 第三方调用

# 2. 请求参数

# 查询参数 Query String parameters

参数名类型必填说明
access_tokenstring接口调用凭证,可使用 component_access_token

# 请求体 Request Payload

参数名类型必填说明
component_appidstring第三方平台 appid
authorizer_appidstring授权方 appid
authorizer_refresh_tokenstring刷新令牌,获取授权信息时得到

# 3. 返回参数

# 返回体 Response Payload

参数名类型说明
authorizer_access_tokenstring授权方令牌
expires_innumber有效期,单位:秒
authorizer_refresh_tokenstring刷新令牌

# 4. 注意事项

# 5. 代码示例

请求示例

{
  "component_appid": "appid_value",
  "authorizer_appid": "auth_appid_value",
  "authorizer_refresh_token": "refresh_token_value"
}

返回示例

{
  "authorizer_access_token": "some-access-token",
  "expires_in": 7200,
  "authorizer_refresh_token": "refresh_token_value"
}

# 6. 错误码

以下是本接口的错误码列表,其他错误码可参考 通用错误码;调用接口遇到报错,可使用官方提供的 API 诊断工具 辅助定位和分析问题。

错误码错误描述解决方案
-1system error系统繁忙,此时请开发者稍候再试
0okok
40001invalid credential  access_token isinvalid or not latest获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的公众号调用接口
40013invalid appid不合法的 AppID ,请开发者检查 AppID 的正确性,避免异常字符,注意大小写
61014must use component token for component api原因是用错了token,使用了 access_token 或者 authorizer_access_token。应该使用component_access_token调用第三方平台的 API。

# 7. 适用范围

本接口支持「第三方平台」账号类型调用。其他账号类型如无特殊说明,均不可调用。