For forms authentication I used this in web.config (note the domain attribute):
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" name=".ASPXAUTH" protection="Validation" path="/" domain=".myserver.dev" />
</authentication>
How is a single sign-on across subdomains configured for the new ASP.NET Identity Framework in Mvc 5?
More Info:
I am creating a multitenant application. Each client will be on a subdomain:
client1.myapp.com
client2.myapp.com
I want a user to be able to sign on to client1.myapp.com
and then go to client2.myapp.com
and still be signed in. This was easy with forms authentication. I'm trying to figure out how to do it with the new Identity Framework.
EDIT
Here is the code that eventually worked for me:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Application",
LoginPath = "/Account/Login",
CookieDomain = ".myapp.com"
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…