刷新 access
该接口用于刷新 access_token 的有效期;该接口适用于抖音/头条授权。
注意:
- 抖音的 OAuth API 以https://open.douyin.com/开头。
- 头条的 OAuth API 以https://open.snssdk.com/开头。
- 西瓜的 OAuth API 以https://open-api.ixigua.com/开头。
- 刷新 access_token 或续期不会改变 refresh_token 的有效期;如果需要刷新 refresh_token 有效期可以调用/oauth/renew_refresh_token/接口。
- access_token 到期后需再次授权,请及时保存。
access_token 有效期说明:
当 access_token 过期(过期时间 15 天)后,可以通过该接口使用 refresh_token(过期时间 30 天)进行刷新:
1. 若 access_token 已过期,调用接口会报错(error_code=10008 或 2190008),refresh_token 后会获取一个新的 access_token 以及新的超时时间。
2. 若 access_token 未过期,refresh_token 不会改变原来的 access_token,但超时时间会更新,相当于续期。
3. 若 refresh_token 过期,获取 access_token 会报错(error_code=10010),此时需要重新走用户授权流程。
状态码排查
请求地址
POST /oauth/refresh_token/
请求头
- Content-Type: multipart/form-data
请求参数
Body 请求
参数名称 | 参数类型 | 参数描述 | 参数示例 | 是否必填 |
---|
暂无数据
响应参数
参数名称 | 参数类型 | 参数描述 | 参数示例 | 是否必填 |
---|
暂无数据
响应样例
{
"data": {
"access_token": "access_token",
"description": "",
"error_code": "0",
"expires_in": "86400",
"open_id": "aaaa-bbbb-cccc-dddd",
"refresh_expires_in": "86400",
"refresh_token": "refresh_token",
"scope": "user_info"
},
"message": "success"
}
响应错误样例
{
"data": {
"description": "Parameter error",
"error_code": 2100005
},
"extra": {
"logid": "2020070614111601022506808001045D59",
"now": 1594015876138
}
}
诚邀您对本文档易读易用性进行评价
好用
不好用