Hello! We're trying to create react component for ...
# ask-a-descoper
a
Hello! We're trying to create react component for the user to see his own tenants, is it possible?
r
Yes, You can let a user see and select their tenants using the Switch Tenant component in a Descope Flow. Once the user selects, the tenant info is available in the flow context via
{{form.userSelectedTenant}}
. You can embed this flow in your React app with the Descope React SDK. Refer this docs: https://docs.descope.com/flows/screens/inputs/tenantselect-component https://github.com/descope/descope-js/blob/main/packages/sdks/react-sdk/README.md
a
thanks @Rahul Rijhwani. but this won't allow me to show a table with my own design right? any way to just get the list?
r
In that case you can get all tenants from management backend SDK and create your own apis to get tenants in frontend and load that tenants into your own UI. Refere this: https://docs.descope.com/management/tenant-management/sdks
m
@Ariel Shiftan
/v1/auth/me
provides the User object which has a
userTenants
field if you'd like to alternatively keep it to just the frontend. In React this is available as the hook
useUser
a
thanks
try it out
it works thanks.
on a related topic - Do I have to use the rule name "tenant admin" for admins? I'd like to use another name, e.g. just "Admin"
r