刷新token
1.功能说明
此接口可以使用refresh_token值对对应的access_token值的有效期进行刷新。
2.接口说明
2.1.接口定义
path | 请求方式 | 接口描述 | 调用权限 |
---|---|---|---|
/uaa/sns/oauth2/refresh_token | POST | 刷新对应access_token的有效期 | 通用权限 |
2.2.请求头说明
名称 | 是否必须 | 类型 | 默认值 | 备注 |
---|---|---|---|---|
Content-Type | true | string | application/json | N/A |
2.3.请求参数说明
名称 | 是否必须 | 类型 | 默认值 | 备注 |
---|---|---|---|---|
grant_type | true | string | refresh_token | 必须,且为"refresh_token" |
appid | true | string | N/A | 开放平台颁发的APPId |
refresh_token | true | string | N/A | 获取access_token时,一起返回的refresh_token |
2.4.返回参数说明
名称 | 是否必须 | 类型 | 备注 |
---|---|---|---|
ret | true | string | 请求是否正常返回状态码:"-1"请求异常 ,"0":请求成功 |
errorCode | true | string | 请求成功返回null,失败返回code码 |
msg | true | string | 成功返回"ok",失败返回错误信息 |
data | false | object | 成功返回数据主体,失败不返回 |
access_token | 依赖data字段 | string | 刷新后的access_token |
refresh_token | 依赖data字段 | object | N/A |
value | 依赖data字段 | string | 刷新access_token需使用的认证凭证 |
expired | 依赖data字段 | boolean | access_token是否过期的标志位 |
openid | 依赖data字段 | string | 用户在云城的唯一id |
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": "refresh_token",
"appid": "d*****b",
"refresh_token": "8*********************8"
}
3.1.成功返回示例
{
"ret":"0",
"errorCode":null,
"msg":"ok",
"data":{
"access_token":"5ab0cc9f-cf37-40e2-aee8-2808fd892d50", // 刷新后的token
"refresh_token":{
"value":"88742977-5c2f-4ea7-8bdc-5db3aaaf3b94" // 用于刷新token的凭证
},
"expired":"false",
"openid":"3**********************c3", // 用户的唯一id
"scope":"[\"app\"]",
"expiration":"1545813026026", // token有效截止时间戳
"token_type":"bearer",
"expires_in":"86398" // token有效期,单位s
}
}
3.2.失败返回示例
{
"ret": "-1",
"errorCode": "109009",
"msg": "获取token失败",
"data": null
}