Nerzal/gocloak

UpdateClient does not update defaultClientScopes

Mikakakaka opened this issue · 2 comments

Keycloak seems to have issues updating client scopes and i have this problem using Gocloak.

I can create a client with the scopes list but when i update an existing client, everything is taken into account exept the defaultClientScopes.

Is it a bug, am I missing something, or is the bug related to Keycloak?

Context

  • Gocloak v13.9.0
  • Keycloak v22.0.5

Thanks in advance

I ran into a similar situation. This is a Keycloak thing. Make sure the client scope you're trying to make default doesn't already exist in the list of optional client scopes. Unfortunately Keycloak doesn't handle this gracefully and the same client scope could exist in both optionalClientScopes and defaultClientScopes and in this case the optionalClientScopes list takes precedence.

See RemoveOptionalScopeFromClient and AddDefaultScopeToClient.

Thanks a lot.
My clients had no optional client scopes but removing every single scope manualy and adding them one by one worked for me. As you suggested in the last part of your message, i used RemoveDefaultScopeFromClient and then AddDefaultScopeToClient using the updated list.