跳到主要内容

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 NameRequiredTypeDescription
grant_typeYesstringGrant 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
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

form-data 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 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}

Request

Responses

Successful Response

Response Headers