刷新Access Token
功能介绍
刷新AccessToken。
URI
POST /api/v1/oauth2/token
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
client_id |
是 |
String |
应用标识,注册应用后,分配的ClientId。 |
|
client_secret |
是 |
String |
应用密钥,注册应用后,分配的ClientSecret。 |
|
refresh_token |
是 |
String |
刷新令牌,获取ID Token接口中返回。 |
|
grant_type |
是 |
String |
授权类型,固定值:refresh_token。 |
响应参数
状态码: 200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
access_token |
String |
授权服务器返回给第三方应用的访问令牌。 |
|
token_type |
String |
访问令牌类型。固定值:Bearer。 |
|
expires_in |
String |
访问令牌的有效期,以秒为单位。 |
|
scope |
String |
授权范围。 |
|
refresh_token |
String |
刷新令牌。 |
|
id_token |
String |
ID Token。 |
状态码: 400
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error |
String |
错误类型。 |
|
error_description |
String |
错误描述。 |
请求示例
基于refresh_token刷新access_token,refresh_token通过调用获取IDToken接口的响应值获取,client_id和client_secret使用注册应用时分配的ClientId和ClientSecret,grant_type为固定值refresh_token。
POST https://{domain_name}/api/v1/oauth2/token
Content-Type: application/x-www-form-urlencoded
client_id=cU0L3GsEq1vuOJ5iQrRSu5AyPnKL8...&
client_secret=EFj******TcE&
refresh_token=b462******7ef&
grant_type=refresh_token
响应示例
状态码: 200
请求成功。
{
"access_token" : "270******6d5",
"token_type" : "Bearer",
"expires_in" : 7200,
"scope" : "openid",
"refresh_token" : "162******412",
"id_token" : "eyJ******YTk"
}
状态码: 400
请求错误。
{
"error" : "invalid_grant",
"error_description" : "Invalid authorization code"
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
请求成功。 |
|
400 |
请求错误。 |
错误码
请参见错误码。