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.
- Obtain the
Hadoop-jwtsession cookie using one of the following methods:- Using your browser
- Open https://console.[***DOMAIN***]/ in your browser.
- Log in with your credentials.
- Open the browser developer tools to access your cookies.
- Copy the value of the
hadoop-jwtcookie.
- 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_JWTis the authentication token used to call APIs.
- Using your browser
