User.Identity.IsAuthenticated is always false

Karan Doshi 0 Reputation points
2023-04-06T09:50:03.8033333+00:00

I am trying to implement single sign on across subdomains using forms authentication and .net Core 3.1. I have a website called parent.com where user logs in and I want to make sure that when user visits child.parent.com, it should be already logged in. I am able to set the .ASPXAUTH cookie from parent.com, and I can even see that cookie in browser when I visit child.parent.com. However when I use User.Identity.IsAuthenticated, I am always getting false as a response, because of which the site is inaccessible. My web.config is working fine as I am able to see the .ASPXAUTH cookie on child.parent.com. I have referred many stackoverflow questions, Microsoft forums, tutorials and offical docs, but I cannot find the solution. Can someone help me with it I have wasted more than 10 days on this issue and still I have reached nowhere near to the conclusion. Thanks in advance.

Developer technologies | ASP.NET | Other
Microsoft Security | Microsoft Identity Manager
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. AgaveJoe 30,126 Reputation points
    2023-04-06T10:57:04.0733333+00:00

    If I understand, you are trying to share an authentication cookie across multiple ASP.NET applications. Please see the official documentation. Share authentication cookies among ASP.NET apps


  2. Bruce (SqlWork.com) 78,006 Reputation points Volunteer Moderator
    2023-04-06T15:22:50.1733333+00:00

    You need to share the encryption keys between the sites. See configuration of data protection services. https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview?view=aspnetcore-7.0

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.