Base solution for your next web application
Open Closed

Autologin to tenant in Multi-Tenant application ASP.NET Core #3898


User avatar
0
omkarchoudhari created

Autologin to tenant in MT application.

we are implementing Multi-Tenancy in single DB using IMustHaveTenant. We want autologin functionality from our desktop app where we are going to pass tenancy name , username and password to the authenticate method. On success of authenticate method we are launching the webapp URL . The expected result is to start the session and it should redirect to tenant dashboard page instead of login screen.

We are able to call authenticate API and it is returning success also. But after launching the URL , its not starting the session.

Please provide <ins>sample code</ins> for implementing this in your ASP.NET Core/angular 2 framework specifically. This is urgent.


7 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Do you mean you do a HTTP call in your desktop app, then launch browser and expect the browser to know you're logged in?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @omkarchoudhari,

    This is outside of AspNet Zero's support scope. This is a custom requirement. Because of that we cannot provide a sample code but we can offer you a solution for this.

    You can send username, password & tenantcy name in the querystring while opening angular web application. Then, in angular application's startup, just execute the login logic if those query string values exists.

  • User Avatar
    0
    omkarchoudhari created

    You can send username, password & tenantcy name in the querystring while opening angular web application. Then, in angular application's startup, just execute the login logic if those query string values exists.

    Where is the actual angular startup method located ? I have the method written but do not know where it is to be called ? In which file ? I have tried calling it in TokenAuthController.cs, but it is of no use.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can do it in AppPreBootstrap.ts. We have used it for similar cases like impersonated and linked account logins, see <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/dev/angular/src/AppPreBootstrap.ts#L25">https://github.com/aspnetzero/aspnet-ze ... rap.ts#L25</a>.

  • User Avatar
    0
    omkarchoudhari created

    the link you mentioned above returns "Page not found !!!!"

  • User Avatar
    0
    aaron created
    Support Team

    You need to login with your GitHub account (added under GitHub Users here) to access the private repo.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @omkarchoudhari,

    Also, if you are not invited on github, you can add your own username here <a class="postlink" href="https://aspnetzero.com/LicenseManagement">https://aspnetzero.com/LicenseManagement</a>.

    Thanks.