接口描述
请求方式:
POST请求地址:登录 企业控制台,选择指定的自建应用。在 “端点信息”模块,获取应用 “Token 端点”作为请求地址。
本接口用于以应用身份获取 access_token,用于调用应用级数据接口。

输入参数
请求头
名称 | 类型 | 必填 | 描述 |
Content-Type | string | 是 | 固定值: application/x-www-form-urlencoded |
请求体参数
名称 | 类型 | 必填 | 描述 |
client_id | string | 是 | 自建应用的 Client ID示例值:i-3f7f5**************************d0 |
client_secret | string | 是 | 自建应用的 Client Secret示例值:HydF******************************{lnL |
grant_type | string | 是 | 固定值: client_credentials示例值:client_credentials |
输出参数
名称 | 类型 | 描述 |
access_token | string | 访问凭证 |
token_type | string | 凭证类型。目前为不记名凭证,即 Bearer |
expires_in | int | 凭证的有效期,单位:秒。 |
示例
输入示例
POST https://oauth2.account.tencent.com/authz/oidc/v2/13580***********30/tokenContent-Type: application/x-www-form-urlencodedclient_id=i-3f7f5*************************d0&client_secret={secret}&grant_type=client_credentials
输出示例
{"access_token": "eyJhb***********************gw","token_type": "Bearer","expires_in": 1800}
错误码
说明:
错误码 | 描述 |
invalid_request | 缺少 client_id / client_secret,或 grant_type 非 client_credentials |
invalid_client | client_id 不存在、应用已禁用,或 secret 不匹配 |
invalid_grant | 应用未启用 client_credentials 授权类型 |
unsupported_grant_type | grant_type 取值不支持 |