我有一个使用react和.NET Core和OAuth的应用程序。
在登录时,我执行
HttpContext.SignInAsync("Cookies", claimsPrincipalWithClaims, authProps)
字符串
我一签字就跑
httpContext.SignOutAsync("Cookies")
型
我退出了UI,但是当我在postman中复制请求时,我仍然可以得到200-我仍然可以得到200,直到会话到期。
在注销后的后续请求中,User.Identity.IsAuthenticated
仍然为true。
每个端点都用[Authorize]
修饰,但仍然返回200 post logout。
注销端点返回Set-Cookie
标头,其中包含:.AspNetCore.Cookies=; expites Thu, 01 Jan 1970 GMP; path=/; secure; samesite=string; httponly;
个
这会杀死应用程序连接,但服务器端-会话仍然存在。
我错过了什么明显的吗?
1条答案
按热度按时间vmdwslir1#
虽然,你还没有公布你是如何以及在哪里调用
httpContext.SignOutAsync("Cookies")
的,但我假设,你可能在你的方法中缺少了async
和await
,这可能是导致这种行为的原因。你能试试下面的方法吗?
字符串