Skip to content
  • Auth and access
  • Manage authentication

Build a switch to navigate between organizations

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.

Step 1: Add org data to ID tokens

Link to this section

The first step is to include a list of organizations a user belongs to, in their ID token.

  1. In Kinde, open the application you want to enable a switcher for. For example, go to Settings > Applications > [View details] > Tokens.
  2. Scroll down to the Token customization section and select Configure on the ID token card. The Customize ID token window opens.
  1. Select the Organizations (array) checkbox in the Additional claims section.
  2. Select Save. This adds the organization id and name to the user’s ID token, in the following format:
"organizations": [
"id": "org_4ba6821b521",
"name": "Golden Finance"
"id": "org_b7226a3b5f0",
"name": "UTM Bank"
"id": "org_16374a4fc3f",
"name": "Trueblue Pty Ltd"

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:

const {getClaim} = useKindeAuth();
console.log(getClaim("organizations", "id_token").value);

Step 2: Build the switcher

Link to this section

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.

const {getClaim, getOrganization} = useKindeAuth();
{getClaim("organizations", "id_token") => (
<li key={}>
<button onClick={() => login({org_code:})} type="button">
{getOrganization().orgCode === ? " (Current)" : null}

With some extra styling, a switcher might look something like this: