登录 Identity Server 4 适用于 Edge、Firefox 和 Opera,但在 Chrome 上失败

Login to Identity Server 4 works on Edge, Firefox and Opera but fails on Chrome

我将 Identity Server 4 与 Umbraco 一起使用。当我从 Edge、Firefox 或 Opera 本地登录 (localhost) 时,登录工作正常。如果我从 Chrome 尝试登录失败。

从 Identity Server 4 日志来看,唯一的区别似乎是 CORS 请求行出现在 Chrome 而不是其他浏览器

[DBG] umbraco found in database: true
[VRB] Calling into client configuration validator: IdentityServer4.Validation.DefaultClientConfigurationValidator
[DBG] client configuration validation for client umbraco succeeded.
---> [DBG] CORS request made for path: /Account/Login from origin: null but was ignored because path was not for an allowed IdentityServer CORS endpoint
[VRB] No endpoint entry found for request path: /Account/Login
[VRB] returnUrl is valid
[DBG] Start authorize request protocol validation
[DBG] umbraco found in database: true

对于 Edge、Firefox 和 Opera,我得到

[DBG] User in authorize request: 1932942018

然后 Chrome 我得到

[DBG] No user present in authorize request

谁能告诉我从哪里开始寻找? 这是 Chrome 问题吗? 与使用本地主机有关的东西? 仅在 Chrome?

中出现的 IS4 配置问题

在 Windows 10 Pro

上使用 Identity Server 4 v4.0.4

查看此 article 如何处理 Chrome 和 SameSite cookies

我也会尝试禁用 SameSite 处理以验证它是否是问题所在。有关如何禁用它的详细信息,请参阅此 article

如果其他人在 Edge 从 Edge Legacy 升级后遇到同样的问题,这里有一个修复程序:

https://getadmx.com/?Category=EdgeChromium&Policy=Microsoft.Policies.Edge::LegacySameSiteCookieBehaviorEnabled

需要新的注册表项:

Computer\HKEY_CURRENT_USER\Software\Policies\Microsoft\Edge\LegacySameSiteCookieBehaviorEnabled

DWORD 值设置为 1