Skip to content

Instantly share code, notes, and snippets.

@kishansagathiya
Created October 12, 2017 15:27
Show Gist options
  • Save kishansagathiya/c1782bdac38a45c6e77b184e881f6953 to your computer and use it in GitHub Desktop.
Save kishansagathiya/c1782bdac38a45c6e77b184e881f6953 to your computer and use it in GitHub Desktop.
#!/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