I have a web app which runs under service.domain.de. For authentication in this app I use Azure AD B2C. In the azure security cookie is for the domain service.domain.de . What can I do to get the security cookie for the domain .domain.de? So with the domain .domain.de the cookie is for the domain.de and all subdomains. The service I wrote in ASP.Net and used Microsoft.Owin.Security library (OpenId).
Asked
Active
Viewed 930 times
1 Answers
1
When you add CookieAuthentication, you can control the domain via CookieAuthenticationOptions' CookieDomain like so:
app.UseCookieAuthentication(new CookieAuthenticationOptions {
CookieDomain = "domain.de"
});

Saca
- 10,355
- 1
- 34
- 47
-
1When I use it. It runs without any errors. But when I return to the my service, after authentication in Azure AD B2C, there is no cookie set. It only works fine wenn I ' app.UseCookieAuthentication(new CookieAuthenticationOptions { CookieDomain = "service.domain.de" });' – Stefan May 30 '17 at 23:04
-
1Did you test this with the deployed site or just with localhost. It will only work in the deployed site provided that it's in that domain or a subdomain of it. – Saca May 31 '17 at 04:49
-
It test it with the deployed site under service.domain.de . When I write CookieDmain = "service.domain.de" it runs fine. By CookieDmain = "domain.de" or CookieDmain = ".domain.de" the cookie will not create. – Stefan May 31 '17 at 06:05