Group doesn't get client roles

Viewed 38

I'm trying to assign a client role 'edit' to a group 'abc'.

enter image description here

All entities exists(clients, roles, group) enter image description here

group_id = admin.get_group_by_path('/abc')['id']
id_client = admin.get_client_id('myclient')
admin.assign_group_client_roles(group_id, id_client,
                                    {'name': 'edit'})

I get an error keycloak.exceptions.KeycloakPostError: 404: b'{"error":"Role not found"}'

Where can be an error?

1 Answers

Looking a bit a the open source code, I think you can try the following:

group_id = admin.get_group_by_path('/abc')['id']
id_client = admin.get_client_id('myclient')
clt_role = admin.get_client_role(client_id=id_client, role_name="edit")
admin.assign_group_client_roles(group_id, id_client, clt_role)
Related