Multi-tenant user cannot log in

Hi, I am evaulating Radzen Blazor Studio and I cannot make multi-tenant functionality work. The problem is that any user from second tenant cannot log into the app. Here are steps to reproduce the issue:

  • I am using Radzen Blazor Studio v. 1.24.3
  • Empty solution on .NET 8 is created
  • Using tenantadmin there are two tenants created
    • tenant t1 with one role r1 and user a
    • tenant t2 with one role r2 and user b
  • Tenants have assigned following hosts
  • I checked database and all information is created and stored properly.
  • I can successfully log in as user a.
  • There is no way to log in as user b regardless of host used.
    • When user b tries to log in, login screen just blinks and return to default (empty) state with no error.
  • I tried to debug whole login process, but I could not get to the issue.

I appreciate any help since Radzen seems to be the right solution for my project, but I need to have multi-tenant working for that.

Hi @coradic,

The Hosts field is used to determine the current tenant. If you browse your app from https://localhost:5001 it will always match the first tenant. There is a button in the Tenants data grid that allows you to switch the active tenant during development:

Hi Korchev,
I could see your point in the code but that is not the point. That is the reason I have host: t2.tenant.com for the second tenant. The problem happens also when I use this t2.tenant.com address.

I also debugged AccountController.cs and Login method and I could see that tenant variable and redirectUrl was correctly set because HttpContext.Request.Host.Value recognized t2 host.

You can try debugging the CurrentUser in AccountController as well and also ApplicationAuthenticationState. Maybe this would reveal what the problem is.

Just an observation, I can't see how this can possibly work when you have localhost:5001 for both tenants??

Normally, you would configure alternate sub-domains to land on different ports..
so t1 would be localhost:5001 and t2 would be localhost:5002..

In debug mode there is a tenant switch option:

yeah, ok, I see.. it needs dummy domain names. Thanks