Search code examples
blazor-webassemblyabp-framework

ABP.IO - Blazor WebAssembly - Tenant-specific login


I'm using the ABP.IO Blazor template for my project, trying to build a simple multi-tenant portal. The problem I am running into is trying to avoid having an end-user select a specific tenant on the login screen.

Using this page as my reference: https://docs.abp.io/en/abp/latest/Multi-Tenancy I attempted to implement the Domain Tenant Resolver (which would be ideal) and ran into a few issues there.

First, The blazor app runs and loads fine with the subdomain, but the login process fails with a 500 error "[ERR] Invalid redirect_uri: https://mysub.localhost/authentication/login-callback". To combat this, I added the "https://mysub.localhost/authentication/login-callback" to the [IdentityServerClientRedirectUris] table in SQL (thinking that I would just extend the tenant creation process to manually create those entries when a new tenant is provisioned). This helped to stop that error from occurring, but at that point the system only allows host user logins to happen, so I'm not sure what I am doing wrong there.

So, after banging my head against the keyboard for a few hours, I switched tactics and tried to use another tenant resolver and tried the QueryStringTenantResolveContributor. Ultimately what I wanted to accomplish was to get a login link for that specific tenant, so I tried https://localhost/authenticate/login?__tenant=075E9FC0-AB8E-C0AC-37FC-39FE07CDDF67 but that doesn't seem to carry over to the API host / Identity server because the login process still only accepts host-user credentials.

FYI, it's using the standard authenticate razor component you see in other tutorials, and I am not sure what (if anything) I can do there to make the tenant stuff stick:

Authentication.razor:

@page "/authentication/{action}"
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
<RemoteAuthenticatorView Action="@Action" />

@code{
    [Parameter] public string Action { get; set; }
}

TL;DR : How the hell do I implement the DomainTenantResolver stuff in Blazor WebAssembly?


Solution

  • Yes, for now, Blazor WASM does not support DomainTenantResolver