Get or Refresh Authorization Token Interface
POST/oauth/token
Basic Information
- Request Path:
/oauth/token - Request Method: POST
- Interface Description: Unified interface for obtaining or refreshing access tokens (access_token)
Request Parameters
Query Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| grant_type | Yes | string | Grant type. Optional 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 |
form-data 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 Access Token
- Set grant_type=refresh_token
- Provide refresh_token
Example
Obtain New Token
POST '/oauth/token?grant_type=&code=&client_id=&client_secret=&refresh_token=' \
--form 'client_secret=""'
Refresh Token
POST /oauth/token?grant_type=refresh_token&refresh_token={refresh_token}