Refreshing Access Token
The default validity period of an Access Token is 2 hours (7200 seconds), with a maximum of 24 hours (86400 seconds). After expiration, user re-authorization is required to obtain a new Access Token. This step enables automatic renewal of authorization, avoiding the need for users to re-authorize and improving the user experience.
# Request Description
POST https://{your_domain}/api/v1/oauth2/token
# Request Headers
| Parameter Name | Chinese Name | Required | Example Value | Description |
|---|---|---|---|---|
| Authorization | Authentication Information | Required | Basic UnFCMNOWk9xWA== | Use client_id and client_secret for basic64 authentication, format: base64(client_id:client_secret) |
| Content-Type | Data Type | Required | application/x-www-form-urlencoded | Submit parameters using form format |
# Request Example
POST https://{your_domain}/api/v1/oauth2/token
Authorization: Basic UnFCMkhKdGt6bFU...aT0NObkk4NlNOWk9xWA==
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&refresh_token=wuGzSMMTjb4YhRUOjXHj-t-QD84
# Request Parameters
| Parameter Name | Chinese Name | Required | Example Value | Description |
|---|---|---|---|---|
| grant_type | Grant Type | Required | refresh_token | This value is fixed as refresh_token |
| refresh_token | Refresh Token | Required | wuGzSMMTjb4YhRUOjXHj-t-QD84 | The refresh token has a maximum validity of 30 days |
# Return Example
Correct Return Example
HTTP Status: 200 OK
{
"access_token": "Z43T3yJNw9es8bruLXRmsXaA",
"token_type": "Bearer",
"refresh_token": "WEq8anwE6qu5aq8mRq5DtHK7YznzDQ2adn5yXkFlFA",
"expires_in": 7199,
"scope": "openid",
"id_token": "eyJra21o...8oEoRsydhg"
}
grant_type parameter value is incorrect
HTTP Status: 400 BAD REQUEST
{
"error": "unsupported_grant_type",
"error_description": "Unsupported grant type"
}
refresh token value is incorrect
HTTP Status: 400 BAD REQUEST
{
"error": "invalid_grant",
"error_description": "Invalid refresh token: wuGzSMMTjb4YhRUOjXHj-t-QD84"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Return Parameters
If the return is successful, the Access Token can be obtained from the return information.
| Parameter | Chinese Name | Required | Example Value | Description |
|---|---|---|---|---|
| access_token | Authorization Token | Required | 3oDi8mk0q9mnTpGxcHu3Gi_vX4o | The authorization token returned by the authorization server to the third-party application. |
| expires_in | Validity Period of Authorization Token | Required | 7199 | The validity period of the access token returned by the authorization server to the application. Note: The validity period is in seconds. |
| refresh_token | Refresh Token | wuGzSMMTjb4YhRUOjXHj-t-QD84 | ||
| token_type | Token Type | Required | Bearer | |
| scope | Authorization Scope | Required | openid |
I understand. Please provide the Markdown content you need translated. I am ready.
