Skip to content

Instantly share code, notes, and snippets.

@matthewfitz
Forked from paoloantinori/keycloak.sh
Last active November 13, 2017 17:58
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 matthewfitz/dddee547af3940af721127b46dd52032 to your computer and use it in GitHub Desktop.
Save matthewfitz/dddee547af3940af721127b46dd52032 to your computer and use it in GitHub Desktop.
Keycloak Admin API Rest Example
brew install jq
#!/bin/bash
export TKN=$(curl -X POST 'http://aim-sso.dev.dmd.works/auth/realms/dmd/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=dmd-web-dev-test" \
-d 'password=dmdtesting123$' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
echo "Access Token";
echo "==================";
echo $TKN;
echo "==================";
export userList=$(curl -X GET 'http://aim-sso.dev.dmd.works/auth/admin/realms/dmd/users' \
-H "Accept: application/json" \
-H "Authorization: Bearer $TKN" | jq .)
echo "User List";
echo "=========";
echo $userList;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment