Configre spring boot


I’m using Keycloak in the version 11.0.

In my spring boot backend application a user is able to create a realm directly via an api call.
This “user”-realm is created with an technical account from the master realm.
In this “user”-realm, a admin user specificly for this realm is created.

With my second api call, my newly created admin account in the “user”-realm should create a new user in the same “user”-realm.

This is currently not possible.

I figured out that the problem is within the I have to define my keycloak config there.
Currently it looks like this:


But my admin user shouldn’t connect to the master realm, it should connect to the self created “user”-realm.
My best gues now was, if I could adapt the as soon as a new realm was created. Is this possible?
I’m getting the error in the following Keycloak.builder() call.

  keycloak = KeycloakBuilder.builder()

Btw. I’m also not sure about the grant type.
Previously my grantType was “password”, but for that i would need a username and password.
Since Keycloak and I don’t save any passwords, this login method is not usable.

Does anyone have any ideas?
I hope my problem is understandable, if not, feel free to ask any questions.

Best Regards