Get or Refresh Authorization Token Interface
POST/oauth/token
Basic Information
- Request Path:
/oauth/token
- Request Method: POST
- Interface Description: A unified interface for obtaining or refreshing the access token (access_token)
Request Parameters
Query Parameters
Parameter Name | Required | Type | Description |
---|---|---|---|
grant_type | Yes | string | Authorization type. Possible values: - authorization_code : Authorization code mode, used to obtain a new token- refresh_token : Refresh token mode, used to refresh an existing token |
code | Conditional Required | string | Authorization code. Required when grant_type=authorization_code |
client_id | Conditional Required | string | Registered client ID. Required when grant_type=authorization_code |
refresh_token | Conditional Required | string | Refresh token. Required when grant_type=refresh_token |
Body Parameters
Parameter Name | Required | Type | Description |
---|---|---|---|
client_secret | Conditional Required | string | Registered client secret. Required when grant_type=authorization_code |
Usage Scenarios
- Obtain a New Access Token
- Set grant_type=authorization_code
- Provide code, client_id, and client_secret
- Refresh an Access Token
- Set grant_type=refresh_token
- Provide refresh_token
Examples
Obtain a New Token
POST /oauth/token?grant_type=authorization_code&code={code}&client_id={client_id}
Content-Type: application/json
{
"client_secret": "{client_secret}"
}
Refresh a Token
POST /oauth/token?grant_type=refresh_token&refresh_token={refresh_token}
Request
Responses
- 200
Successful Response