刷新access_token
发布时间:2025-03-08 11:38:19
来源: 亿登科技
请求方式:POST
请求地址:https://idaas-api.yidengtech.com/third/oauth2/v1/{app_id}/token
请求头
|
名称
|
说明
|
必须
|
示例值
|
描述
|
|
Authorization
|
身份验证凭据
|
否
|
Basic YXBwMTIzOmFwcF9zZ
|
Base64编码的client_id和client_secret,即: base64(client_id:client_secret)
|
|
Content-Type
|
请求体的数据格式
|
是
|
application/x-www-form-urlencoded
|
告知服务器请求体(Body)中数据的格式是表单键值对
|
请求参数
|
名称
|
说明
|
必须
|
示例值
|
描述
|
|
grant_type
|
授权类型
|
是
|
refresh_token
|
固定值 refresh_token
|
|
refresh_token
|
刷新令牌
|
是
|
8xLOxBtZp8
|
|
|
client_id
|
客户端ID
|
否,二选一
|
app123
|
如果请求头中没有Authorization则必填
|
|
client_secret
|
客户端密钥
|
否,二选一
|
app_secret_123
|
如果请求头中没有Authorization则必填
|
成功响应
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6Ikp...",
"refresh_token": "8xLOxBtZp8",
"token_type": "Bearer",
"expires_in": 3600
}
|
名称
|
说明
|
必须
|
示例值
|
描述
|
access_token
|
访问令牌
|
是
|
eyJhbGciOiJSUzI1...
|
用于调用API的JWT令牌
|
|
refresh_token
|
刷新令牌
|
否
|
8xLOxBtZp8
|
用于获取新的access_token
|
|
token_type
|
令牌类型
|
是
|
Bearer
|
通常为 Bearer
|
|
expires_in
|
过期时间
|
是
|
3600
|
access_token有效期(秒)
|
|
scope
|
实际授权范围
|
否
|
错误响应
{
"error": "invalid_request",
"error_description": "Invalid refresh_token"
}
|
名称
|
说明
|
必须
|
示例值
|
描述
|
|
error
|
错误码
|
是
|
invalid_grant
|
错误类型
|
|
error_description
|
错误描述
|
否
|
授权码无效或已过期
|
可读的错误描述
|