gpt4 book ai didi

javascript - 重定向在 chrome.identity 中不起作用

转载 作者:行者123 更新时间:2023-12-04 19:48:04 25 4
gpt4 key购买 nike

我一直在开发一个使用 chrome.identity.launchWebAuthFlow 的 chrome 应用程序用于根据用户的 Google 帐户对用户进行身份验证的 API。

设置:

  1. 点击应用中的登录按钮执行以下代码:
    chrome.identity.launchWebAuthFlow({'url': <AUTH-URL>, 'interactive': true},
    function(redirect_url) {
    <handle URL here>
    }
    });

<AUTH-URL>指向我自己服务器上的一个端点,它重定向到 https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http://<APP-ID>.chromiumapp.org/...&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&access_type=offline&approval_prompt=force

此流程在两天前运行良好。单击该按钮将打开 chrome 身份窗口,显示 Google 登录页面,输入我的凭据将调用回调函数。

这今天停止工作。单击登录按钮后,我只看到“无法加载授权页面”消息。

我尝试在服务器上设置 5 秒延迟(在重定向之前),但在 5 秒结束之前出现“无法加载授权页面”消息。

知道会发生什么吗?

最佳答案

在登录流程无法正常工作 2 天后,我们终于解决了这个问题。正在呈现的页面 (<AUTH-URL>) 包含一个 Google 跟踪代码管理器片段。

我们最近更新了它以包括 MixPanel。这导致了一些 <script>带有 async 的元素要注入(inject)页面的属性。从 GTM 中删除 Mixpanel 立即解决了问题。

我猜这是删除了 <script async ...>成功了。这不仅仅是 OAuth 流程 - 简单 <a>链接也不起作用。

关于javascript - 重定向在 chrome.identity 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30052100/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com