Http 角度客户端连接在 Duende IdentityServer v6 中不断重新加载

问题描述 投票:0回答:1

我有一个带有 OIDC 客户端应用程序的 Angular 14,该应用程序使用 OIDC 客户端连接到 Duende IdentityServer v6。客户端应用程序使用 HTTP 运行,而 Duende IdentityServer 在本地开发中在 HTTPS 上运行,在登录过程中它重定向到 IdentityServer,在成功身份验证后,它重定向回客户端应用程序。

现在浏览器不断重新加载为无限。我发现原因是HTTP的原因。如果我更改为 HTTPS,它就可以正常工作。

我也设置了 CORS

app.UseCors("CorsPolicy");

并在客户端配置中

new Client
            {
                ClientId = "Fete_Bird_UI",
                ClientName = "FeteBirdUI",
                AllowedCorsOrigins = CorsUris(configuration),
                // ......
            }

在数据库里,我可以看到

asp.net asp.net-core identityserver4 duende-identity-server duende
1个回答
0
投票

使用 IdentityServer 时必须使用 HTTPS,这主要是由于当今浏览器中的 samesite cookie 处理。

为了补充这个答案,我写了一篇博客文章,更详细地介绍了该主题:调试 ASP.NET Core 中的 cookie 问题

© www.soinside.com 2019 - 2024. All rights reserved.