Last active
July 26, 2022 16:03
-
-
Save deangrant/5155d13612f1edff5813c542534832e7 to your computer and use it in GitHub Desktop.
Test shell script to return access token as from Keycloak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export USERNAME={{ username }} | |
export PASSWORD={{ password }} | |
export CLIENT_ID={{ client_id }} | |
export CLIENT_SECRET={{ client_secret }} | |
export HOSTNAME={{ hostname }} | |
export REALM={{ realm }} | |
export AUTH_TOKEN=`curl -s -d "client_id=$CLIENT_ID" -d "client_secret=$CLIENT_SECRET" \ | |
-d "username=$USERNAME" -d "password=$PASSWORD" -d "grant_type=$PASSWORD" \ | |
"https://$HOSTNAME:8443/auth/realms/$REALM/protocol/openid-connect/token" | jq -r '.access_token'` | |
echo $AUTH_TOKEN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment