Localhost cross subdomain cookies

Viewed 186

I have a site with various subdomains

I would like the default asp.net core 2 authentication to work on all subdomains. When I have the code below it only works for the domain that is logging in with.

 services.ConfigureApplicationCookie(options =>
 {
      options.Cookie.Domain = "localhost";
      options.LoginPath = "/Account/LogIn";
     ...
 });

If I change options.Cookie.Domain = ".localhost"; then it does not even add the cookie to the authenticating subdomain. I have also tried ".localhost:44338" and ".localhost:44338".

Not sure if its maybe something to do with using localhost (since it can only fake subdomains).

Edit: I am using chrome

Edit: When I use real domain names instead of localhost it works.

0 Answers
Related