首页 > 解决方案 > 如果第三方 cookie 被阻止,则使用 oidc-client 跨域进行静默续订

问题描述

我们有两个 SPA 应用程序,它们与同一个 IdentityProvider 交互。我们实现了 oidc-client 并且 SSO 运行良好。现在我们认识到,如果第三方 cookie 被阻止,静默身份验证将不起作用,这是一个大问题。

默认情况下,Safari、Firefox 等浏览器已经阻止第三方 cookie。在 SPA 应用程序中执行 Session_Management 和 Access_Token 管理的推荐方法是什么。

我们不希望用户再次登录,如果 IdentityProvider 上的 Session 仍然处于活动状态(会话处于活动状态 14 天,具有滑动到期)。

我有哪些选择?

标签: cross-domainidentityserver4openid-connectoidc-client-js

解决方案


Based on the comments on the OP and having experimented a bit... If I set the auth cookie to SameSite=Lax then iframe-based silent calls do not work but top-level redirects are not affected. Therefore SameSite=Lax breaks OIDC and thus it's necessary to have a comprehensive CSRF solution in place instead if you wish to use the standard client side pattern.


推荐阅读