From 4bd0c696e3f30b8aab5fbf2e30c26e140504d8b2 Mon Sep 17 00:00:00 2001 From: Khaled <45347802+JavaDeveloper456788@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:56:40 -0800 Subject: [PATCH] Update update-kc.sh --- Keycloak/update-kc.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Keycloak/update-kc.sh b/Keycloak/update-kc.sh index 4dfdd58..19b2a8a 100644 --- a/Keycloak/update-kc.sh +++ b/Keycloak/update-kc.sh @@ -63,7 +63,16 @@ do --data-raw "$line") echo -e " Response : $result\n" default_scopes=$(echo "$line" | jq -r '.defaultClientScopes[]') + clientId=$(echo "$line" | jq -r '.clientId') echo "$default_scopes" | while read -r scope; do - echo "$scope" + echo "$clientId" + echo "$scope" + #PUT /{realm}/clients/{id}/default-client-scopes/{clientScopeId} + result=$(curl -s -v -w "%{http_code}" -X PUT "$KC_BASE_URL/$KC_REALM_ID/clients/$clientId/default-client-scopes/$scope" \ + --header "Authorization: Bearer $TKN" \ + --header "Content-Type: application/json" \ + ) + echo -e " Response : $result\n" + done done < clients.sh