The realm role is not added when creating a user.
See original GitHub issueDescribe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior: When creating a user, I call the kcAdminClient.users.create function.
I pass the object there:
{
realm: 'SOME_REALM',
username: userData.username,
email: userData.email,
firstName: userData.firstName,
lastName: userData.lastName,
enabled: true,
requiredActions: [
RequiredActionAlias.VERIFY_EMAIL,
],
realmRoles: ['CLIENT_ADMIN'],
}
But after the user is created, the role is not applied to the user.
Expected behavior The roles that are transferred in the array are applied to the user.
Enviroment (please complete the following information):
- OS: [Ubuntu]
- Keycloak Version: 15.0.0
- Library Version: 15.0.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Realm role is not assigned while creating user - Getting advice
Currently user is created and credentials are assigned, but role is not assigned. I created this role manually using administrator console.
Read more >Unable to assign realm Role to a newly created Keycloak ...
Problem: The user is successfully created but it is not assigned a role (realmRole). After some more research I found that this behaviour...
Read more >Mapper "User Realm Role" does not include group ... - Red Hat
Mapper "User Realm Role" adds the current user's realm roles to the ID token and/or access token. However, it seems that it's only...
Read more >Using Keycloak Admin Client to create user with roles (Realm ...
Create a realm, Go to your realm in Keycloak, go to the users, create a user, just give it username, then save, go...
Read more >Mapping users and groups to roles | Elasticsearch Guide [8.5]
When you use role mappings to assign roles to users, the roles must exist. There are two sources of roles. The available roles...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lmorningstar116
Why has this issue being closed ?
There is a sort of workaround, but the issue is still present (and api seems broken).
What if I don’t want to assign a group ?
Yes, the group solution did the trick. At first it will work, but this behavior is very strange.