About organizations
Build on Kinde
A common pattern in B2B products is for users who belong to multiple organizations to be able to switch between them. This topic demonstrates how to achieve this.
The first step is to include a list of organizations a user belongs to, in their ID token.
id
and name
to the user’s ID token, in the following format:You can now extract the organizations
claim from ID tokens in the way you normally would. Typically the SDK you are using will have a method for this.
For example, in React you could use:
To build a simple list of orgs, use something like the following React example. You’ll need to include a call to the login
method for each organization, passing in the id.
In this example, we’ve also included a check to see if this is the current organization.
With some extra styling, a switcher might look something like this: