Skip to content

Instantly share code, notes, and snippets.

@akoserwal
Created August 23, 2024 20:15
Show Gist options
  • Save akoserwal/5463f9efd18537573bb194ad07fd94ce to your computer and use it in GitHub Desktop.
Save akoserwal/5463f9efd18537573bb194ad07fd94ce to your computer and use it in GitHub Desktop.
get-token.sh
KEYCLOAK_URL=http://0.0.0.0:8084
REALM=test
CLIENT_ID=admin-cli
USERNAME=admin
PASS=admin
TOKEN_PATH="/realms/master/protocol/openid-connect/token"
RESULT=`curl -sk --data "grant_type=password&client_id=$CLIENT_ID&username=$USERNAME&password=$PASS" $KEYCLOAK_URL$TOKEN_PATH`
TOKEN=$(jq -r '.access_token' <<< $RESULT)
echo $TOKEN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment