Getting or Refreshing a token
POST/auth/v1/token
1.Refresh Token Refresh Mechanism
Interface Description
Obtain a new access_token using a valid refresh_token. The original refresh_token will become invalid immediately (compliant with RFC 6749 Section 6).
Request Sample:
{
"client_id": "mock_AAU5Pw78ioGQnUP4",
"grant_type": "refresh_token",
"refresh_token": "mock_m.yPxK8mLnVrQwEoDzFcHbNtGsYvXpRjWq-3eSd2fA1gU5iI9kO0lP7uJ4mT6nB8yC_1xZ2vD3aQ4wF5eR6tG7hY8jM9kL0oN1iP2uK3lQ4mW5nX6bV7cC8dA9fS0gH1jJ2kL3mN4o"
}
2. Password Mode Authentication
Interface Description
Obtain an access_token based on Resource Owner Password Credentials Grant (RFC 6749 Section 4.3)
Request Sample:
{
"client_id": "mock_AAU5Pw78ioGQnUP4",
"grant_type": "password",
"username": "mock_user001",
"password": "mock_password@123"
}
3. Client Credentials Grant
Interface Description
Obtain a server-side access_token using Client Credentials Grant (RFC 6749 Section 4.4)
Authentication Method
Add request header:
Authorization: Basic ${base64(SecretId:SecretKey)}
{
"client_id": "mock_AAU5Pw78ioGQnUP4",
"grant_type": "client_credentials"
}
Key Features
- Does not return a refresh_token
- Automatic granting of super administrator permissions
- Need to obtain SecretId/SecretKey via Tencent Cloud CAM
Security Specifications:
- SecretKey must be stored in a secure storage medium
- The caller must possess a server-side trusted environment
Request
Query Parameters
The client ID corresponding to the application, which defaults to the environment ID and can be omitted
Header Parameters
Device ID
- application/json
Body
Responses
- 200
- 500
A successful response.
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
Always returns Bearer
Token used to access the Cloud Development HTTP API, with a maximum length of 4096 characters
When the access_token expires, it can be refreshed using the refresh_token to obtain a new access_token. The default expiration time is 31 days. Maximum length is 128 characters
Expiration time of the access_token in seconds
{
"token_type": "string",
"access_token": "string",
"refresh_token": "string",
"expires_in": 0,
"scope": "string",
"sub": "string",
"groups": [
"string"
]
}
An unexpected error response.
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
{
"error": "string",
"error_code": 0,
"error_description": "string"
}