• Data Warehouse Service

dws
  1. Help Center
  2. Data Warehouse Service
  3. API Reference
  4. Environment Preparation
  5. Obtaining Request Authentication Information
  6. Token Authentication

Token Authentication

Scenarios

The token is used to call APIs and authenticate the calling request.

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.

Invoking an API

  1. Send the request for obtaining the user token, that is, POST https://IAM endpoint/v3/auth/tokens.

    To obtain the value of parameter IAM endpoint in the request, visit the Regions and Endpoints.

    Obtain the following parameters in the request message body:

    • username: username
    • user password: user login password
    • domain name: name of the enterprise account to which the user belongs
    • project id: project ID. Obtain it by referring to section Obtaining a Project ID. Assume that the ID is 0215ef11e49d4743be23dd97a1561e91.
    An example request message is as follows:
    NOTE:

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

    {
      "auth": {
        "identity": {
          "methods": [
            "password"
          ],
          "password": {
            "user": {
              "name": "username",
              "password": "password",
              "domain": {
                "name": "domainname"
              }
            }
          }
        },
        "scope": {
          "project": {
            "id": "0215ef11e49d4743be23dd97a1561e91"      
          }
        }
      }
    }
  2. Obtain the token. For details, see section "Obtaining the User Token" in the Identity and Access Management API Reference. The token is the value of X-Subject-Token in the response.
  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 2.