Skip to content

Instantly share code, notes, and snippets.

@jarryDk
Forked from paoloantinori/keycloak.sh
Created February 23, 2017 06:49
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 jarryDk/3122f0e5c3c1b6d2a05c7210e154f455 to your computer and use it in GitHub Desktop.
Save jarryDk/3122f0e5c3c1b6d2a05c7210e154f455 to your computer and use it in GitHub Desktop.
Keycloak Admin API Rest Example
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
-H "Accept: application/json" \
-H "Authorization: Bearer $TKN" | jq .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment