Authentication
You can use either of the following authentication methods when calling APIs:
- AK/SK-based authentication: Requests are encrypted using AK/SK pairs.
- Token authentication: Requests are authenticated using a token.
Authentication Using Tokens
- The validity period of a token is 24 hours. When using a token for authentication, cache it to prevent frequently calling the IAM API.
- Ensure that the token is valid while you use it. Using a token that will soon expire may cause API calling failures.
A token specifies certain permissions in a computer system. Authentication using a token adds the token to a request as its header during API calling to obtain permissions to operate APIs through IAM.
{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"name": "username", //Username
"password": "********", //Login password
"domain": {
"name": "domainname" //Name of the account to which the user belongs
}
}
}
},
"scope": {
"project": {
"name": "xxxxxxxx" //Project name
}
}
}
}
After a token is obtained, the X-Auth-Token header field must be added to requests to specify the token when calling other APIs. For example, if the token is ABCDEFJ...., X-Auth-Token: ABCDEFJ.... can be added to a request as follows:
Content-Type: application/json X-Auth-Token: ABCDEFJ....
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.