Switch Tenant
The Switch Tenant component allows users to select one of their associated tenants during a flow. Once selected, tenant details can be used in conditions, logic branches, or displayed on screen. This guide explains how to use the component, access selected tenant data, and dynamically update tenant information within a flow.
The Component
Note
Tenants will automatically be sorted in alphabetical order.
Create a new screen inside a flow, and search for "Switch Tenant":
This component allows a user to choose from the list of tenants they are associated with. Once selected, the tenant's details are available for use in the flow.
Implementing Tenant Selection In Descope Flows
Flow Overview
The example below shows a flow where a user selects a tenant. The flow then evaluates the selected tenant’s name using a condition.
- If the tenant name is "test", the flow ends.
- Otherwise, the tenant's SSO configuration is shown.
A Closer Look At The Condition
Here is a closer look at the condition that uses the tenant's name:
You can also use the tenant's domain(s) and any custom attributes you define. For creating custom attributes, you can read further here.
Using The Selected Tenant Form Value
After the user selects a tenant in the flow, it can be accessed from the form context as {{form.userSelectedTenant}}
.
JWT After Tenant Selection
After the tenant has been selected, the JWT will have the dct
(descope current tenant) claim marking which tenant is the actively
selected tenant. If there's just one tenant associated with the user, the tenant does not have to be selected because the dct
is automatically set to that one tenant.