跳到主要内容

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 NameRequiredTypeDescription
grant_typeYesstringAuthorization 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
codeConditional RequiredstringAuthorization code. Required when grant_type=authorization_code
client_idConditional RequiredstringRegistered client ID. Required when grant_type=authorization_code
refresh_tokenConditional RequiredstringRefresh token. Required when grant_type=refresh_token

Body Parameters

Parameter NameRequiredTypeDescription
client_secretConditional RequiredstringRegistered client secret. Required when grant_type=authorization_code

Usage Scenarios

  1. Obtain a New Access Token
    • Set grant_type=authorization_code
    • Provide code, client_id, and client_secret
  2. 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

Successful Response

Response Headers