Multi Tenancy With Multiple realm

Hello,

I have a multi tenancy with multiple realms setup in my keycloak and one frontend application, each realm has it’s own set of users etc. The question is how to determine which realm to redirect the user to from the FE app. I can think of two approaches

  1. determine user realm in FE app by asking user to provide username/email then redirect
  2. a custom flow to a main client in keycloak then redirect user to dist client but I run into client session issues when I redirect from one client to another

could I get some direction on which approach to go for and I would appreciate any recommendations for different approaches

If your “tenant realms” have users with a distinct email domain, you could make use of the new Organizations feature.
You would have one “app realm”, where all the tenant realms are configured as external IdP and also configured with an organization, which does automatic redirection upon entering the proper email-address.
This way, your client has only to be configured in and talk to one realm, but you can also keep the existing tenant realms.


You don’t want to do this, this is a man in the middle. You want to avoid by all means the contact between your client and users credentials.