问题描述
我有一个依赖 SharedArrayBuffer 的网络应用程序。我在我的网站上开启了跨域隔离,因为谷歌浏览器将在月底前要求它。
但是,这样做会中断 Google oAuth2 登录。
我尝试导入带有跨域标志的 auth 脚本,但没有成功,因为它依次尝试导入其他被阻止的脚本。
登录.html
...
var script = document.createElement('script');
script.src = "https://apis.google.com/js/platform.js?onload=init";
script.setAttribute('async','true');
script.setAttribute('defer','true');
script.setAttribute('crossorigin','');
document.getElementsByTagName('head')[0].appendChild(script);
...
仍然可以使用谷歌的 oAuth2 的最佳方法是什么?
谢谢,
解决方法
跨域隔离破坏 OAuth 集成是一个已知问题(请参阅以“2021 年 4 月更新”开头的 the box in this page)。请apply to the origin trial在没有跨域隔离的情况下继续使用 SharedArrayBuffer。
团队正在努力放宽限制。