p2-inc / keycloak-orgs

Single realm, multi-tenancy for SaaS apps
Other
362 stars 65 forks source link

Adding a Organization on Signup #191

Closed andreknieriem closed 4 months ago

andreknieriem commented 4 months ago

Hi, I just wonder, if it is possible to add an organization on user signup. I just to create a new organization by name. Any idea how to achieve this?

xgp commented 4 months ago

Sure @andreknieriem we do this in our own dashboard application. You can automatically grant the create-organization realm management role to the user on creation, and then call the API to create an organization after the user logs in (if they don't already have one).

Alternately, if you don't mind a bit of Java, you can write an EventListenerProvider to look for user creation events and then create the organization for the user with the OrganizationProvider.