• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference
  4. APIs
  5. Authenticating Requests
  6. Token Authentication

Token Authentication

Scenarios

If you use a token for authentication, you must obtain the user's token and add X-Auth-Token to the request message header of the service API when making an API call.

This section describes how to make an API call for token authentication.

Make an API Call

  1. Send POST https://IAM endpoint/v3/auth/tokens to obtain the IAM endpoint and the region name in the message body. For details, see Regions and Endpoints.
    An example request message is as follows:
    NOTE:

    Replace the items in italic in the following example with actual ones. For details, see and Access Management API Reference.

    {
      "auth": {
        "identity": {
          "methods": [
            "password"
          ],
          "password": {
            "user": {
              "name": "******",
              "password": "******",
              "domain": {
                "name": "domainname"
              }
            }
          }
        },
        "scope": {
          "project": {
            "name": "eu-de" //The project name "eu-de" is used as an example.
          }
        }
      }
    }
  2. Obtain the token. For details, see section "Obtaining User Token" in the Identity and Access Management API Reference. After the request is processed, the value of X-Subject-Token in the message header is the token value.
  3. Make a call to a service API, add X-Auth-Token to the message header, and set the value of X-Auth-Token to the token obtained in step 2.