• 请不要在回答技术问题时复制粘贴 AI 生成的内容
wymanAtV2
V2EX  ›  程序员

Chrome Samesite 策略调整后, iframe 嵌入外部系统无限重定向求解

  •  
  •   wymanAtV2 · Dec 29, 2021 · 2689 views
    This topic created in 1622 days ago, the information mentioned may be changed or developed.

    最近遇到一个需求,要在现有的系统中嵌入一个外部系统,两个系统都使用同一个统一登录服务器,在 Chrome 浏览器中,会出现重定向次数过多的情况,查看了一下请求发现,当“外部系统”打开时会进行自己的统一登录,结果无限 302 ,导致页面无法加载,各位大佬帮忙支支招,有什么解决方案嘛?在此先谢过大家🙏

    7 replies    2021-12-30 10:47:30 +08:00
    hgc81538
        1
    hgc81538  
       Dec 29, 2021
    set-cookie 加 SameSite=None
    wymanAtV2
        2
    wymanAtV2  
    OP
       Dec 29, 2021
    @hgc81538 感谢,思路是对的,但最后还是需要外部系统配合在他的 set-cookie 上改才行,现在已经解决了,感谢🙏
    chihiro2014
        3
    chihiro2014  
       Dec 29, 2021
    @wymanAtV2 我们当时是用 token
    wymanAtV2
        4
    wymanAtV2  
    OP
       Dec 30, 2021
    @chihiro2014 使用 token 的话,那访问外部系统的时候要怎样将 token 带过去呢?不过因为统一登录那边还是使用 cookie 所以这个方案实现有点难度😂
    chihiro2014
        5
    chihiro2014  
       Dec 30, 2021
    @wymanAtV2 token 使用单独接口获取,然后在访问 iframe 里面嵌套页面的时候,前端进行获取,然后塞到 header 里面,后面进行判断是否携带 token 。
    wymanAtV2
        6
    wymanAtV2  
    OP
       Dec 30, 2021
    @chihiro2014 学到了,感谢🙏
    chihiro2014
        7
    chihiro2014  
       Dec 30, 2021
    @wymanAtV2 token 要拼接在 url 后面的,一开始。这个方案我们也是试了好久。新增了一套 token 认证的方案,这才走通的。iframe 现在不太合适了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5412 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 08:29 · PVG 16:29 · LAX 01:29 · JFK 04:29
    ♥ Do have faith in what you're doing.