Skip to content

Commit

Permalink
Print response if request failed
Browse files Browse the repository at this point in the history
  • Loading branch information
gf-rog committed May 15, 2024
1 parent b8f852b commit 40203cb
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions keycloak/login-user.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
request=\
request_body=\
"grant_type=password"\
"&client_id=mercury-testing"\
"&client_secret=5mwGU0Efyh3cT2WVX7ffA8UAWEAmrBag"\
"&[email protected]"\
"&password=metaverse4ever"

access_token=$(curl \
response=$(curl \
-sS \
-X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "$request" \
localhost:3000/realms/mercury/protocol/openid-connect/token \
| jq -r .access_token)
-d "$request_body" \
localhost:3000/realms/mercury/protocol/openid-connect/token)

access_token=$(echo "$response" | jq -r .access_token)

echo "Access token:"
echo "$access_token"

if [ "$access_token" = "null" ]; then
echo "Response:"
echo "$response"
fi

0 comments on commit 40203cb

Please sign in to comment.