Get Your Access Token

To get the access token used to authenticate your session, you use Cloud Assembly IaaS API to make a POST request with the API token as input.

After 25 minutes of inactivity, the access token times out and you must request it again.

Prerequisites

  • Verify that you are an organization owner in VMware vRealize Automation Cloud with access to the Cloud Assembly service.
  • Verify that you have an API Token. See Obtain an API Token with the Organization Owner organization role and the Cloud Assembly administrator role.
  • If your organization uses an API service that is hosted outside of the United States, verify that you know the country abbreviation for your API endpoint. For example, if your organization is located in Australia, your country abbreviation is AU and your API endpoint is https://au.api.mgmt.cloud.vmware.com For all country abbreviations, see Regional Endpoints for vRealize Automation Cloud APIs.

Procedure

  1. Assign the API token variable.
    api_token='<your_API_Token>'

    your_API_Token is the token you obtained using the UI for VMware vRealize Automation Cloud.

  2. With the API token assigned, request the access token.
    access_token=`curl -X POST \
      "$url/iaas/api/login" \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/json' \
      -d '{
      "refreshToken": "'$api_token'"
    }' | jq -r .token`
  3. Verify the access token variable is assigned.
    The access token is a long JSON Web Token as in the following example.
    # echo $access_token
    eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InNpZ25pbmdfMiJ9.eyJzdWIiOiJ2bXdhcmUuY29tOj...
    ...
    tSQ74_XhszGifZe_gFdxw