# Multi tenancy :- Which is the best approch

**URL:** <https://forum.keycloak.org/t/multi-tenancy-which-is-the-best-approch/18196>\
**Category:** Miscellanaeous\
**Created:** [October 31, 2022, 2:52am UTC](https://forum.keycloak.org/t/multi-tenancy-which-is-the-best-approch/18196 "2022-10-31T02:52:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![safeer2345](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/safeer2345/32/6919_2.png) [@safeer2345](https://forum.keycloak.org/u/safeer2345)\
**Post date:** [October 31, 2022, 2:52am UTC](https://forum.keycloak.org/t/multi-tenancy-which-is-the-best-approch/18196/1 "2022-10-31T02:52:52Z")

</div>

We’re having a B2B application and we are planning to add IAM module as multi tenant. We have lots of companies as tenants so should I use multiple realms as tenant or single realm and multiple group as tenant

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [October 31, 2022, 6:29am UTC](https://forum.keycloak.org/t/multi-tenancy-which-is-the-best-approch/18196/2 "2022-10-31T06:29:59Z")

</div>

There are several approaches that have been discussed here. The particulars of each depends on how you will use keycloak, the permissions/role model, and if you intend to allow each of your customers/tenants to use their own IdP.

I have an approach here that solves many of the problems, but requires you to install a custom extension:

> **[GitHub - p2-inc/keycloak-orgs: Single realm, multi-tenancy for SaaS apps](https://github.com/p2-inc/keycloak-orgs)**
>
> Single realm, multi-tenancy for SaaS apps. Contribute to p2-inc/keycloak-orgs development by creating an account on GitHub.
