Skip to content

Commit

Permalink
chore: make keycloak init script more robust
Browse files Browse the repository at this point in the history
do not fail if the secret is not set, as is the case
for public clients. It seems that in current version of Keycloak
the server doesn't return a secret for public clients (makes sense)
but in older versions it did (doesn't make sense).
  • Loading branch information
rokroskar committed Jan 6, 2022
1 parent e20f6eb commit d08cc8e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/init-realm/init-realm.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def _check_and_create_client(keycloak_admin, new_client):
# We have to separately query the secret as it is not part of
# the original respone
secret = keycloak_admin.get_client_secrets(realm_client["id"])
realm_client["secret"] = secret["value"]
# public clients don't have secrets so default to None
realm_client["secret"] = secret.get("value", None)

# We have to remove the auto-generated IDs of the protocol mapper(s)
# before comparing to the to-be-created client.
Expand Down

0 comments on commit d08cc8e

Please sign in to comment.