7

我们正在运行一个连接到 Firebase 的简单应用程序,它会读取一些数据。它无法连接并出现以下超时错误:

@firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential",
"message":"Credential implementation provided to initializeApp() 
via the \"credential\" property failed to fetch a valid Google OAuth2 access token 
with the following error: \"Failed to parse access token response: Error: Error 
while making request: connect ETIMEDOUT

我们在防火墙/代理后面,它似乎正在阻止进出 Firebase 的流量,因此连接失败。我的问题是需要打开哪些端口以及哪些目标 URL 才能使该应用程序正常工作?

任何帮助都感激不尽!

4

1 回答 1

9

最后,在为这个问题苦苦挣扎了几天之后,它开始工作了。需要联系网络团队并请求执行以下操作:

  1. 为 Firebase 通信打开端口 5228、5229、5230。
  2. 在源服务器和以下 URL 之间的代理级别打开通信:

    fcm.googleapis.com

    gcm-http.googleapis.com

    account.google.com

    {项目名称}.firebaseio.com

  3. 在我的 node.js 应用程序中添加了以下代码:

    var globalTunnel = require('global-tunnel-ng');
    
    globalTunnel.initialize({
      主机:'<proxy-url>',
      端口:<代理端口>,
      //proxyAuth: 'userId:password', // 可选认证
      sockets: 50 // 每个 http 和 https 的可选池大小
    });
  4. 安装模块global-tunnel-ng

    npm install global-tunnel-ng

它解决了我的问题,我希望它也可以帮助其他人。:-)

于 2018-11-16T11:49:51.877 回答