improve script

This commit is contained in:
burnettk 2022-07-07 13:08:55 -04:00
parent f8b4e21acc
commit 376d808223
1 changed files with 5 additions and 4 deletions

View File

@ -36,10 +36,11 @@ result=$(curl -s -X POST "$KEYCLOAK_URL" "$INSECURE" \
-d "password=$PASSWORD" \ -d "password=$PASSWORD" \
-d 'grant_type=password' \ -d 'grant_type=password' \
-d "client_id=$CLIENT_ID") -d "client_id=$CLIENT_ID")
TOKEN=$(jq -r '.access_token' <<< "$result")
echo TOKEN: $TOKEN token=$(jq -r '.access_token' <<< "$result")
if [[ $(echo $TOKEN) != 'null' ]]; then if [[ "$token" != 'null' ]]; then
export KEYCLOAK_TOKEN=$TOKEN echo "token: $token"
else
echo "Failed auth result: $result"
fi fi