Is is possible the create users via Admin REST API using other client than “admin-cli” ?
My scenario:
I would like to be able to create Realms, Roles ,Users from my application.
User logs into the application with “foo” client using standard flow.
User wants to create user in the app. → user create api call to Keycloak relaying the authorization token.
If the admin logs in (has the admin role) he can create realms, roles, clients this way. But the user creation is forbidden. ( {“error” = “unknown error”})
then using the token I can create new realms, new roles in those realms, new clients in those realms, but i can not create new users. (foo client using “realm roles” protocol mapper)
I can only create new users using the “admin-cli” client. Is this the intended way, what is so special about this client? I cant find any special settings for this client.
SOLVED! The problem was that i tried to create the user using the token generated for the master realm’s client. So when i use this token to interract with the API on an other realm it failed. The ‘admin-cli’ worked, because it’s a global client, every realm contains it.
It’s not 100% the cause, but seems logical.
What I’m end up doing is creating the user (and other objects) within the realm creation api call.