![](/img/trans.png)
[英]ASP.NET Core Identity 2.0 SignoutAsync is not logging out user if the user signed in with Google
[英]ASP.Net Core 2.0 SignOutAsync deleting the wrong Cookie?
我有一個ASP.net Core 2.0 MVC應用程序,遇到了一個奇怪的問題。 在我的AccountsControler.cs中使用HttpContext.SignInAsync(...)登錄用戶時,這將創建一個名為“ .AspNetCore.Identity.Application”的Cookie。 稍后使用HttpContext.SignOutAsync()登出用戶時,ASP.net Core決定通過在Response-Header中將此Cookie設置為在unix時代過期來刪除cookie名稱“ Identity.External”。
好像我的CookieAuthentication出了點問題。 有人知道,去哪里找?
FunFact:這兩個名稱都不是我希望看到的,因為我為CookieAuthentication配置了完全不同的名稱:
services.AddAuthentication (CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie (
options => {
options.Cookie.Name = "MyMagic.User";
}
);
其實問題似乎是我用過的
service.AddAuthentication(...)
在這個應用程序中。 在我的代碼中看起來像是ASP.net Core 1.0遷移工件。
刪除顯式Cookie身份驗證后, SignInAsync()和SignOutAsync()使用相同的Cookie名稱。
此外,
services.ConfigureApplicationCookie(opts => {
opts.Cookie.Name = "My.Cookie.User";
});
我能夠重命名cookie。 :)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.