Newly added admin of realm can't login to the realm in Keycloak

8.6k Views Asked by At

There are 2 realms in Keycloak: master and custom. Both have admin users.

Custom realm admin adds new user new_admin and assigns role admin to him via admin console.

The user can access his account details at auth/realms/custom/account/.

However, error Forbidden You don't have access to the requested resource pops when new_admin user tries to enter realm administration console at auth/admin/custom/console/.

The same issue happens even when master realm admin adds new admin user to custom realm.

I'm using Keycloak 4.3.0.

Is it a bug or realm can't have two admins?

2

There are 2 best solutions below

1
On BEST ANSWER

The solution was to assign role realm-admin of realm-management client to the second admin user.

enter image description here

1
On

You must explicitly assign the roles of "custom-realm" to the second admin user. In admin console select the master-realm and go to "Role Mappings" of the second admin user. In the drop-box "Client Roles" select "custom-realm" and then assign the desired available roles to the user.

enter image description here