chatgpt登录出现获取您的 SSO 信息时出错

发表于2025年01月13日 17:28:53 • 阅读29

chatgpt登录出现获取您的 SSO 信息时出错解决方案

阅读大约需要1分钟。


解决方案

// 原始的 fetch 函数
const originalFetch = window.fetch;

// 修改后的 fetch 函数
window.fetch = new Proxy(originalFetch, {
   apply: function (target, thisArg, argumentsList) {
      const [url, options] = argumentsList;

      // 解析 URL 以检查是否是特定的 API 请求
      const parsedUrl = new URL(url, window.location.origin);
      // /public-api/get_user_connection_info
      console.log(`parsedUrl.pathname = ${parsedUrl.pathname}`)

      const checkpathName = parsedUrl.pathname.includes('get_user_connection_info')


      if (checkpathName) {

         // 如果是特定的 API 请求,直接返回预设的响应
         
         return Promise.resolve({
            ok: true,
            json: () => Promise.resolve({
                "connections": [],
                "must_use_enterprise_sso": false
            })
         });
      } else {
         console.log(`originalFetch url = ${url}`)
         // 否则,调用原始的 fetch 函数
         return target.apply(thisArg, argumentsList);
      }
   }
});

直接在每个网页之前使用这个hook,先拦截返回响应即可。

有时候真的烦。


所属分类: 前端

文章标签: #js #chatgpt

文章标题:chatgpt登录出现获取您的 SSO 信息时出错

文章作者:大古

文章链接:https://blog.988898.xyz/archives/chatgpt-login-appears-to-have-an-error-getting-your-sso-information.html

版权声明:本站原创内容均采用《署名 - 非商业性使用 - 相同方式共享 4.0 国际》进行许可,转载请注明出处。

温馨提示:请注意文章发表时间,某些文章所述内容可能具有时效性,文章描述可能已经失效。

添加新评论
暂未有人评论
快来抢沙发