• MapReduce Service

mrs
  1. Help Center
  2. MapReduce Service
  3. API Reference
  4. Environment Preparation
  5. 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.

Making 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 the Identity and Access Management API Reference.

    {
      "auth": {
        "identity": {
          "methods": [
            "password"
          ],
          "password": {
            "user": {
              "name": "username",
              "password": "password",
              "domain": {
                "name": "domainname"
              }
            }
          }
        },
        "scope": {
          "project": {
            "name": "project name" 
            
          }
        }
      }
    }
  2. Obtain the token. For details, see section Obtaining the 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.