Skip to content

Instantly share code, notes, and snippets.

@mriedmann
Last active May 29, 2019 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mriedmann/acd909b77b4f44f09e8cf4d753c997ad to your computer and use it in GitHub Desktop.
Save mriedmann/acd909b77b4f44f09e8cf4d753c997ad to your computer and use it in GitHub Desktop.
Test Keycloak with Linux CLI
#!/bin/bash
PROTO=http
#PROTO=https
HOST=172.17.0.3:8080
HOST_HEADER=test.blub
PROTO_HEADER=http
#HOST=kc-test.loopback
JWT=$(curl -k \
-H "Host: $HOST_HEADER" \
-H "X-Forwarded-Proto: $PROTO_HEADER" \
-d 'client_id=test' \
-d 'username=admin' \
-d 'password=admin' \
-d 'grant_type=password' \
"$PROTO://$HOST/auth/realms/master/protocol/openid-connect/token" | jq -r '.access_token')
echo $JWT | cut -d. -f 2 | base64 -d | jq -r '.iss'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment