Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/bin/bash
REALM="master"
CONTENT_OF_THE_JSONFILE=$(<testrealm.json)
export TKN=`curl -k -v -X POST "http://keycloak-kc-kishan.dev.rdu2c.fabric8.io/auth/realms/$REALM/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 -H "Content-Type: application/json" -H "Authorization: bearer $TKN" -X POST -d "$CONTENT_OF_THE_JSONFILE" http://keycloak-kc-kishan.dev.rdu2c.fabric8.io/auth/admin/realms -D-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment