Tenants with SDKs
If you wish to learn more about Tenants in general, visit our section on Tenant Management.
The Descope service supports multi-tenancy architecture natively. Each project can have multiple tenants, and the end-users can be assigned to either the project or can belong to one or many tenants. The most common use case of tenants is when you are building a B2B application, and each of your customers can have multiple users. You must manage these users and their roles at a tenant level. Descope admins can create and update tenants either manually in the Descope console or using the tenant management API and sdk from within their application as show below.
Tenant management using the management SDK
Install SDK
Import and initialize Management SDK
Load All tenants
Use the code below to load all existing tenants within the project
Load Tenant by ID
This function allows for you to load a specific tenant based on the tenant's ID.
Search Tenants
This function allows for you to search Descope tenants by ID, name, self service provisioning domain, and custom attributes.
Create Tenant
At the time of creation, the tenant must be given a name and a tenant-id. If you don't provide a tenant-id, a tenant-id is automatically generated. The tenant-id is used for sign-up/sign-in and other management operations later. In addition, you can also set domains for the tenant. The domain is used to automatically assign the end-user to a tenant at the time of sign-up and sign-in. The tenant name must be unique per project. The tenant ID is generated automatically for the tenant when not provided.
Update Tenant
Use the code below to update an existing tenant with the given name and domains. All parameters are used as overrides to the existing tenant. Empty fields will override populated fields.
Delete Tenant
Use the code below to delete an existing tenant. Please note that this action is irreversible.
Update Tenant Password Policy
Use the code below to update password policy for your tenant.