Base solution for your next web application
Open Closed

Login to Host account while using "appBaseUrl": {TENANCY_NA} #5568


User avatar
0
tugrulkarakaya created

Hi, How can I login to host accoutn while I set tanants site as subdomains. when I tried to jump from one of tenant by using linked account it brings me to the main site (<a class="postlink" href="http://www.mydomain.com">www.mydomain.com</a>) not host.mydomain or etc. so it seems I can not login to host at that case? urgent problem. thx.


6 Answer(s)
  • User Avatar
    0
    tugrulkarakaya created

    I have just managed to login by writing any non-existing subdomain like blabla.mydomain.com/?gotolinkedaccountID (or something lke that) it works manually but it should go with properly or there should be a way to do it? any help or idea?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    If you set your appBaseUrl like {TENANCY_NAME}.mydomain.com, then you can access to host website using mydomain.com. You need to leave {TENANCY_NAME} part empty.

  • User Avatar
    0
    tugrulkarakaya created

    Yes I notice that app brings me to the mydomain.com address but that domain is totally different domain. {subname}.mydomain.com is for clients (for app) mydomain.com is for company not for host tenant. (Null tenant) it seems someone else suffers from the smilar problem; #5482

    To sum up; I do not want to use bare domain for host. I need any other sub (does not matter the name) as host because DNS records for mydomain.com and *.mydomain.com are also different . these are out of my control.

  • User Avatar
    0
    ismcagdas created
    Support Team

    In that case, you need to do something like this <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1608#issuecomment-418185262">https://github.com/aspnetzero/aspnet-ze ... -418185262</a> and use it like this <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1608#issuecomment-418211767">https://github.com/aspnetzero/aspnet-ze ... -418211767</a>.

    If you follow that approach, you can reserve a keyword (host for example) for the host website.

  • User Avatar
    0
    michelmk2 created

    <cite>ismcagdas: </cite> In that case, you need to do something like this <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1608#issuecomment-418185262">https://github.com/aspnetzero/aspnet-ze ... -418185262</a> and use it like this <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1608#issuecomment-418211767">https://github.com/aspnetzero/aspnet-ze ... -418211767</a>.

    If you follow that approach, you can reserve a keyword (host for example) for the host website.

    Would I add those things in the *.web.mvc project or in the *.web.host project?

    Thanks!

    EDIT: Okay so the domainresolver works. When I log go to host.{domain}.com, I can login to the host environment. Still when you use linked accounts to switch to {subdomain}.{domain} and then back to {host}.{domain}, you will recieve an error:

    System.ArgumentNullException: Value cannot be null.
    Parameter name: user
       at Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory`1.&lt;CreateAsync&gt;d__9.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Abp.Authorization.AbpUserClaimsPrincipalFactory`2.<CreateAsync>d__1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Robin.Authorization.Users.UserLinkManager.&lt;GetSwitchedUserAndIdentity&gt;d__14.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Robin.Web.Controllers.AccountController.&lt;SwitchToLinkedAccountSignIn&gt;d__55.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Abp.Threading.InternalAsyncHelper.&lt;AwaitTaskWithPostActionAndFinallyAndGetResult&gt;d__5`1.MoveNext()
    --- End of stack trace from previous ...
    
  • User Avatar
    0
    ryancyq created
    Support Team

    Hi, you can define your custom domain tenant resolver related code in ..Web.Core project.

    For switching from host account to tenant account, did you use the method here? <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/f72d4bf9ced778e06265f1c415a8553b10cbaf3d/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Mvc/Controllers/AccountController.cs#L804">https://github.com/aspnetzero/aspnet-ze ... er.cs#L804</a>