获取服务access_token
1.功能说明
此接口用于获取服务的access_token,获取到服务access_token后可以调用云城接口对三方服务进行操作,如三方服务的推送能力
2.接口说明
2.1.接口定义
| path |
请求方式 |
接口描述 |
调用权限 |
| /uaa/cgi-bin/token |
POST,GET |
获取服务access_token |
通用权限 |
2.2.请求头说明
| 名称 |
是否必须 |
类型 |
默认值 |
备注 |
| Content-Type |
true |
string |
application/json |
N/A |
2.3.请求参数说明
| 名称 |
是否必须 |
类型 |
默认值 |
备注 |
| grant_type |
true |
string |
client_credential |
必填,且为"client_credential" |
| appid |
true |
string |
N/A |
开放平台颁发的APPID |
| secret |
true |
string |
N/A |
开放平台颁发的APPkey |
2.4.返回参数说明
| 名称 |
是否必须 |
类型 |
备注 |
| ret |
true |
string |
请求是否正常返回状态码:"-1"请求异常 ,"0":请求成功 |
| errorCode |
true |
string |
请求成功返回null,失败返回code码 |
| msg |
true |
string |
成功返回"ok",失败返回错误信息 |
| success |
true |
boolean |
成功返回true,失败返回false |
| data |
false |
object |
成功返回数据主体,失败不返回 |
| access_token |
依赖data字段 |
string |
APPID对应服务的access_token |
| refresh_token |
依赖data字段 |
null |
null |
| expired |
依赖data字段 |
boolean |
access_token是否过期的标志位 |
| expiration |
依赖data字段 |
string |
access_token有效期截止时间戳 |
| token_type |
依赖data字段 |
string |
access_token的类型 |
| expires_in |
依赖data字段 |
string |
access_token有效时限,单位为s |
| scope |
依赖data字段 |
string |
N/A |
3.请求示例
{
"grant_type": "client_credential",
"appid": "a******t",
"secret": "1********7"
}
3.1.成功返回示例
{
"ret": "0",
"errorCode": null,
"msg": "ok",
"data": {
"access_token": "968b6b93-8a95-422f-91aa-6e04d1ecac6e",
"refresh_token": null,
"expired": "false",
"scope": "[\"all\"]",
"expiration": "1553952065802",
"token_type": "bearer",
"expires_in": "86399"
},
"success": true
}
3.2.失败返回示例
{
"ret": "-1",
"errorCode": "",
"msg": "无效的appid或者secret",
"data": null,
"success": false
}