From 376d808223298f290ae86195044b85055badcc6e Mon Sep 17 00:00:00 2001 From: burnettk Date: Thu, 7 Jul 2022 13:08:55 -0400 Subject: [PATCH] improve script --- bin/get_token | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/get_token b/bin/get_token index a5ed806c..3bdeadac 100755 --- a/bin/get_token +++ b/bin/get_token @@ -36,10 +36,11 @@ result=$(curl -s -X POST "$KEYCLOAK_URL" "$INSECURE" \ -d "password=$PASSWORD" \ -d 'grant_type=password' \ -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 - export KEYCLOAK_TOKEN=$TOKEN +if [[ "$token" != 'null' ]]; then + echo "token: $token" +else + echo "Failed auth result: $result" fi