使用 usehttpsredirection 用户已正确验证。但是当我评论此代码时 usehttpsredirection 并将安全策略 CookieSecurePolicy.Always 更改为 CookieSecurePolicy.None.
但我在登录用户详细信息时遇到问题,用户未经过身份验证。
你能帮我吗?
使用 Usehttpsredirection 工作正常。
但我只想使用http。在这种情况下,我正在评论 Usehttpsredirection 并且用户未经过身份验证。
您必须在浏览器与 Client 和 IdentityServer 之间使用 HTTPS。您可以在客户端/API 和 IdentityServer 之间使用 HTTP。
为什么?
因为身份验证过程中设置的一些重要的cookie会被浏览器阻止(由于同站点规则)。
我在博客中介绍了如何调试 ASP.NET Core 中的 cookie 问题。