Getting a Cloudera Data Engineering API access token

Cloudera Data Engineering uses JSON Web Tokens (JWT) for API authentication. To interact with a virtual cluster using the API, you must obtain an access token for that cluster.

  1. Obtain the Hadoop-jwt session cookie using one of the following methods:
    1. Using your browser
      1. Open https://console.[***DOMAIN***]/ in your browser.
      2. Log in with your credentials.
      3. Open the browser developer tools to access your cookies.
      4. Copy the value of the hadoop-jwt cookie.
    2. Using curl
      DOMAIN="[***DOMAIN***]"
      USERNAME="[***LDAP CREDENTIAL CONFIGURED DURING INSTALLATION***]"
      PASSWORD="[***LDAP CREDENTIAL CONFIGURED DURING INSTALLATION***]"
      
      # Hit the console — it redirects to the SSO login page
      REDIRECT_URL=$(curl -sk "https://console.${DOMAIN}/" -o /dev/null -w '%{redirect_url}')
      
      # Authenticate at the SSO endpoint and save the cookie
      curl -sk -X POST -u "${USERNAME}:${PASSWORD}" -c cookies.txt "${REDIRECT_URL}" -o /dev/null
      
      # Extract the cookie value
      HADOOP_JWT=$(grep hadoop-jwt cookies.txt | awk '{print $NF}')
      echo "${HADOOP_JWT}"
      

      HADOOP_JWT is the authentication token used to call APIs.