- Service Overview
- Billing
- Getting Started
-
User Guide
- Before You Start
- Buying an Instance
- Instance Management
-
Enterprise Administrator Guide
- Logging In to the OneAccess Administrator Portal
- User Management
-
Resources
- Overview
-
Applications
- Adding an Application
- Enabling, Disabling, or Deleting an Application
- General Information
- Authentication Integration
- Synchronization Integration
- Login Configuration
- Access Control
- Object Models
- Authorization Management
- API Permission Management
- Application Permission Management
- Security Settings
- Audit Logs
- APIs
- Authentication
- Security
- Audit
- Settings
- Common User Guide
- Key Operations Recorded by CTS
-
Best Practices
- OneAccess Best Practices
- Identity Source Integration
-
Application Integration
-
Logging In to the Huawei Cloud Through User Portal
- Introduction
- Logging In to Single Huawei Cloud Account via OneAccess Without Password (SAML - Virtual User SSO)
- Logging In to Multiple Huawei Cloud Accounts via OneAccess Without Password (SAML - Virtual User SSO)
- Logging In to Single Huawei Cloud Account via OneAccess Without Password (SAML - IAM User SSO)
- Logging In to Multiple Huawei Cloud Accounts via OneAccess Without Password (SAML - IAM User SSO)
- Logging In to Huawei Cloud via OneAccess Without Password (OIDC)
- SSO Access to Applications Through SAML
- SSO Access to Applications Through OAuth 2.0
- SSO Access to Applications Through OIDC
- SSO Access to Applications Through CAS
- SSO Access to Applications Through Plug-in Autocompletion
-
Logging In to the Huawei Cloud Through User Portal
- Data Synchronization
- Authentication Provider Integration
- Authorizing IAM Users to Access a OneAccess Instance Administrator Portal
- API Usage
- Configuring MFA for User Login
- Developer Guide
-
API Reference
- Before You Start
- API Overview
-
OneAccess APIs
-
Management APIs
- Calling APIs
- Access Credentials
-
User Management
- Creating a User
- Modifying a User
- Deleting a User
- Enabling a User
- Disabling a User
- Changing a User Password
- Verifying and Modifying the Original User Password
- Querying User Details by User ID
- Querying User Details by Username
- Querying the User List
- Authorizing an Application Account
- Querying All Authorized Application Accounts of a User
- Organization Management
- Application Organization Management
- Application Account Management
- Application Role Management
- User APIs
- Application Integration APIs
-
Management APIs
- Appendix
- FAQs
- General Reference
Copied.
Obtaining an Access Credential
Function
This API is used to obtain the application API access credential. A token is valid for 30 minutes by default. You can configure the validity period in "Administrator Portal" > "Settings" > "Service Settings" > "API Authentication". Cache your token to prevent frequent API calling. Ensure that the token is valid while you use it. Using a token that will soon expire may cause API calling failures. Obtaining a new token does not affect the validity of the existing token.
Constraints
null
URI
POST /api/v2/tenant/token
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
grant_type |
Yes |
String |
Grant type. The value is fixed at client_credentials. |
client_id |
Yes |
String |
Application ID, which is a client ID allocated to an application after registration. |
client_secret |
Yes |
String |
Application secret, which is a client secret allocated to an application after registration. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
access_token |
String |
Authentication credential, which is used to call management APIs. |
token_type |
String |
Authentication credential type. This value is fixed at Bearer. |
expires_in |
Integer |
Time when the token will expire. Unit: second. Default value: 1,800. |
scope |
String |
Authorization scope of the obtained access token. |
id_token |
String |
Authorized access ID token. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error details. |
Example Requests
Obtain the credential, namely, the API authentication token, by using the application client ID and client secret.
POST https://{domain_name}/api/v2/tenant/token Content-Type: application/x-www-form-urlencoded client_id=ONtQq2igSggfFClyGgzmuXR8ubWEP...& client_secret=XdqUmJpG19hNEHz3472XsPcwvfe...& grant_type=client_credentials
Example Responses
Status code: 200
Request successful.
{ "access_token" : "334******140", "token_type" : "Bearer", "expires_in" : 1719, "scope" : "all", "id_token" : "ey******Is.ey******Yo.EL******YW" }
Status Codes
Status Code |
Description |
---|---|
200 |
Request successful. |
400 |
Invalid parameter. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot