I am struggling to create a user with a client role. My client is called client_interface.
Below you see my java code! It seems to not create a client nor a realm user so in total it’s doing nothing and I don’t know why.
ANY idea?
Sorry I missed your message. You just need to create the user object. There are APIs to add the roles and you need role ids (not names) which you need to look up potentially first.
I’m sorry we only used the admin rest api. We had to get the id of the role by name and then use PUT to add the json structure for roles as defined in user representation.
i now its not a recent ticket but i ran recently into the same problem resource not found while trying to map the userClientRole by doing this: userResource.roles().clientLevel(clientId).add(listOf(userClientRole))
the client role, i just created, i forgot to retrieve the saved instance which includes the id of the role. Without the id the mapping cannot take place which is logical ofcourse but the mistake not to fetch the role or to create a role with an id at forehand is easy made.
hope this helps someone
cheers