Base solution for your next web application
Open Closed

RE: Angular - Detect tenant from email address #4069


User avatar
0
paradoxit created

Please can anyone advise how I detect the tenantId from email address used to login so I can present a single domain and login to the users? I will prevent the same users being associated with multiple tenants.

I have seen this article : <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#determining-current-tenant">https://aspnetboilerplate.com/Pages/Doc ... ent-tenant</a>

However there is little detail of implementation, i.e. where do I add the resolver etc?

Thanks for any help in advance.

Kind regards, David


2 Answer(s)
  • User Avatar
    0
    paradoxit created

    Is this something I need to implement on the Angular side as you login? I.e. lookup the users tenant and then set a cookie? If so how do I implement setting the cookie?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ParadoxIT,

    You can implement this using a custom TenantResolver or in the login action. I think for your case, it is better to implement it in the login.

    You need to follow a similar way of this topic #3935@73484b8b-5055-43b9-aa8a-d934de909f28. Different than this topic, you need to do it in the TokenAuthController and return back the tenantId with the token and store it on the client side as we do for tenant change on the login page.

    You also need to hide/remove tenant change functionality I think.