I use the keycloak python API to assign user roles. Here is the code:
from keycloak import KeycloakAdmin # establish a connection admin = KeycloakAdmin (server_url = "https: //xxx.xx.xx/auth/", username = "xx", password = "xxx", domain_name = "xxx-xxx", verify = True) # get a user ID via a user name userID = admin.get_user_id (self.userName) # assign a user role admin.assign_client_role (client_id = "client_id", user_id = userID, #role_id = "role_id", role_name = "test")
to make the connection and
Get the user ID via the user name a part is successful. But
assign_client_role () gives me an error:
TypeError: assign_client_role () received an unexpected keyword argument, "role_name"
It seems that the arguments do not match those defined in the function. My code refers to the example of this site.
Could someone tell me how to fix it?