首页 > 解决方案 > iframe 中的 Safari cookie

问题描述

最新的 Safari 更新阻止 iframe 中的第 3 方 cookie。(https://webkit.org/blog/10218/full-third-party-cookie-blocking-and-more/

他们提供了几种解决方案来解决它。我试图实现存储访问 API 解决方案,但确实喜欢结果。

任何人都可以在没有有关如何实现此功能的技术细节的情况下给出提示或示例流程:

Option 1: OAuth 2.0 Authorization with which the authenticating domain (in your case, the third-party 
that expects cookies) forwards an authorization token to your website which you consume and use to 
establish a first-party login session with a server-set Secure and HttpOnly cookie.

firstparty.com 在 iframe 中有 3rdparty.com。根据option 13rdparty.com 通过 OAuth 授权,接收令牌。但是“将令牌转发到您的网站以建立登录会话”是什么意思?3rdparty.com 是否应该在单独的窗口中以第一方身份运行登录例程?

标签: cookiesiframesafari

解决方案


他们指的是仍然让 cookie 成为第一方(在您的网站上)。例如:

用户遵循以下流程:

  1. 访问 website.com
  2. 重定向到 oauthSite.com 进行身份验证
  3. ouathSite.com 使用令牌(或代码)重定向回 website.com
  4. website.com 在服务器端代码上本地设置令牌
  5. 用户现在拥有可用于与 website.com 进行无状态交互的安全(仅限 https)和 HttpOnly(JavaScript 无法访问)cookie 令牌

这个网站似乎认为流程很好: https ://medium.com/@darutk/diagrams-and-movies-of-all-the-oauth-2-0-flows-194f3c3ade85


推荐阅读