Switch Logged In User Organization Using an Organization Picker

Overview

This article describes how to implement a mechanism that allows logged-in users to switch their current organization context. This functionality requires the New Universal Login experience, as Auth0 Organizations are not supported in Classic Universal Login.

Applies To

  • Auth0 Organizations

  • New Universal Login

  • Auth0 Single Page App SDK

Solution

  1. Ensure the tenant is configured to use the New Universal Login experience.

  2. Provide a mechanism in the application user interface, such as a dropdown menu or button, for the user to select the target organization.

  3. Call the loginWithRedirect() method from the Auth0 SDK upon selection.

  4. Pass the chosen organization's ID in the organization parameter:

loginWithRedirect({ organization: 'NEW_ORG_ID' })

This process redirects the user, establishes the session within the context of the newly selected organization, and returns the user to the application with the appropriate tokens.

Recommended content

No recommended content found...