# Roles for Suborganizations

**URL:** <https://community.auth0.com/t/roles-for-suborganizations/86444>\
**Category:** Get Help\
**Tags:** organizations, login, roles\
**Created:** [July 5, 2022, 2:39pm UTC](https://community.auth0.com/t/roles-for-suborganizations/86444 "2022-07-05T14:39:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathias.mahlknecht](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mathias.mahlknecht/32/33197_2.png) [@mathias.mahlknecht](https://community.auth0.com/u/mathias.mahlknecht)\
**Post date:** [July 5, 2022, 2:39pm UTC](https://community.auth0.com/t/roles-for-suborganizations/86444/1 "2022-07-05T14:39:03Z")

</div>

Hi,

we are currently evaluating Auth0 for our use cases.

We have multiple clients that use our application, which we can easily hold in Auth0 as organizations.  
But additionally, we need to divide these organizations further into suborganizations, these suborganizations again can consist of suborganisations, and so on.

User can be members of all or of some suborganizations and have different roles for different suborganizations.

As I can see, it Auth0 currently does not support suborganizations.  
It might be possible to hold the information about the suborganizations in our domain and check it with a login action or rule.  
But for this it has to be possible:

- to trigger a token refresh if the user changes suborganization
- to add a role to the token only, but not to the user

Is this possible? Or are there other ways we could achieve our use cases?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [July 13, 2022, 12:45am UTC](https://community.auth0.com/t/roles-for-suborganizations/86444/3 "2022-07-13T00:45:37Z")

</div>

Hi there @mathias.mahlknecht welcome to the community!

> [@mathias.mahlknecht](#):
>
> As I can see, it Auth0 currently does not support suborganizations.

That’s correct, Auth0 does not currently support sub-organizations. Typically, what I have seen implemented is a tenant per customer + Organizations or simply an Organization per what would be “nested” Organization where each of these has their own database assigned.

The following thread has some good information regarding a user switching Organizations:

> [@User switch between Organization](https://community.auth0.com/t/user-switch-between-organization/62609/2):
>
> Answering some questions that I posed after some digging around for an implentation. Using the React-sdk, we can use the getAccessTokenSilently from the auth0 hook and pass in organization (similar to the same prop on the Auth0Provider) with the new org\_id when a user wants to switch organization. To do this, we have to pass in the ignoreCache flag when we get the access token (otherwise you’d get the same access token for the same organization. Drawback is obvious, if a user switches back an…

Here is an FAQ regarding adding roles to tokens:

[https://community.auth0.com/t/how-to-add-roles-and-permissions-to-the-id-token-using-actions/84506](https://community.auth0.com/t/how-to-add-roles-and-permissions-to-the-id-token-using-actions/84506)

Regarding:

> [@mathias.mahlknecht](#):
>
> to add a role to the token only, but not to the user

Are you able to elaborate on what you mean here? No roles will exist at [/api/v2/users/{id}](https://auth0.com/docs/api/management/v2/#!/Users/get_users_by_id) but rather [/api/v2/users/{id}/roles](https://auth0.com/docs/api/management/v2/#!/Users/get_user_roles) for top level roles and [/api/v2/organizations/{id}/members/{user\_id}/roles](https://auth0.com/docs/api/management/v2/#!/Organizations/get_organization_member_roles) for Organization specific roles.

I did also find an existing Feedback request for sub-organizations:

> [@Hirearchial Organizations](https://community.auth0.com/t/hirearchial-organizations/84964):
>
> Feature: I would like to have hierarchical organizations structure Description: I would like the ability to create a hirearchial brand structure similar to what is described here ([How do I handle "organizations" in a hirearchy](https://community.auth0.com/t/how-do-i-handle-organizations-in-a-hirearchy/84811)) Use-case: It would allow finer grain control over access.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![mathias.mahlknecht](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mathias.mahlknecht/32/33197_2.png) [@mathias.mahlknecht](https://community.auth0.com/u/mathias.mahlknecht)\
**Post date:** [July 13, 2022, 6:23am UTC](https://community.auth0.com/t/roles-for-suborganizations/86444/4 "2022-07-13T06:23:45Z")

</div>

Thanks, this was very helpful.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [July 13, 2022, 5:39pm UTC](https://community.auth0.com/t/roles-for-suborganizations/86444/5 "2022-07-13T17:39:43Z")

</div>

No problem, happy to help! 😄

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [July 28, 2022, 5:40pm UTC](https://community.auth0.com/t/roles-for-suborganizations/86444/6 "2022-07-28T17:40:12Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
