Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.
- Function Overview
- What's New
- Service Overview
- Getting Started
-
User Guide
- Configuration Management
- HTTP Proxy
- Commonly Used Commands
-
Options
- Option Overview
- Printing Help Information
- Printing Debugging Information
- Checking Command
- Specifying Region
- Calling APIs with an Account in Non-configuration Mode
- Calling APIs with AK/SK in Non-configuration Mode
- Calling APIs with a Token in Non-configuration Mode
- Calling APIs Using an Agency in Non-configuration Mode
- Specifying Account ID
- Specifying Profile
- Specifying Authentication Mode
- Specifying Output Format
- Passing API Parameters with JSON File
- Specifying Request Timeouts
- Specifying Retry Count
- Skipping HTTPS Request Certificate Verification
- Specifying a Domain Name
- Obtaining CLI Examples on API Explorer
- Using KooCLI in Non-configuration Mode
- Obtaining Authentication Information
-
FAQs
- Overview
- Authentication
- Profiles
- Metadata Cache
- Logs
- Network Connections
- Cloud Services
- Cloud Service APIs
- Regions
-
Parameters
- What Are KooCLI System Parameters?
- Why Am I Seeing a Message Indicating an Invalid Parameter?
- Why Are Old and New KooCLI System Parameters (Such as region and cli-region) Available? Which Parameters Are Recommended?
- Why Am I Seeing a Message Indicating a Duplicate Parameter?
- How Do I Use cli-jsonInput?
- When Can I Use cli-jsonInput?
- Why Am I Seeing a Message Indicating an Unsupported Parameter Position or Type?
- How Do I Leave a Body Parameter Empty for Cloud Service APIs?
- Interactive Mode and Autocomplete
-
Output Formats
- What Output Formats Are Supported by KooCLI?
- How Do I Define a JMESPath Expression?
- Which KooCLI System Parameters Are Related to Data Output? Which Ones Are Recommended?
- How Do I Use cli-output, cli-query, and cli-output-num?
- How Do I Use cli-output-rows, cli-output-cols, and cli-output-num? What Are the Precautions?
- How Do I Use cli-json-filter? What Are the Precautions?
- Other
- Videos
Obtaining a Token
A token is an access credential issued to an IAM user to bear the user's identity and permissions. The validity period of a token is 24 hours. Cache the token to prevent frequent API calling. The original token will be valid till it expires regardless of whether a new token has been obtained. Ensure that the token is valid when you use it. Using a token that will soon expire may cause API calling failures. You can obtain a token using any of the following methods:
Debugging an API in API Explorer
Set parameters on the page of the IAM API KeystoneCreateUserTokenByPassword on API Explorer, and click Debug. The value of X-Subject-Token in Response is a token.
Using Postman
Use Postman to obtain a token. If 201 is returned after you send a request, click Header. The value of X-Subject-Token is a token.
Using KooCLI
hcloud IAM KeystoneCreateUserTokenByPassword --cli-region=${regionName} --auth.identity.methods.1="password" --auth.identity.password.user.name=${IAM user name} --auth.identity.password.user.password=${IAM user password} --auth.identity.password.user.domain.name=${Name of the account to which the IAM user belongs} --auth.scope.domain.name=${Name of the account to which the IAM user belongs} --cli-output=tsv --cli-query="response_header.X-Subject-Token[0]"
If the invocation is successful, the returned result is a token.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.