代码之家  ›  专栏  ›  技术社区  ›  Manoj Goel

如何在防火墙/代理后使用Firebase?

  •  -1
  • Manoj Goel  · 技术社区  · 6 年前

    我们正在运行一个简单的应用程序,它连接到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才能使此应用程序正常工作?

    1 回复  |  直到 6 年前
        1
  •  6
  •   Manoj Goel    6 年前

    最后,在与这个问题斗争了几天之后,它终于成功了。需要联系网络团队并请求执行以下操作:

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

      fcm.googleapis.com

      gcm-http.googleapis.com

      accounts.google.com

      {项目名称}.firebaseio.com

    3. var globalTunnel = require('global-tunnel-ng');
      
      globalTunnel.initialize({
        host: '<proxy-url>',
        port: <proxy-port>,
        //proxyAuth: 'userId:password', // optional authentication
        sockets: 50 // optional pool size for each http and https
      });
    4. 已安装模块 global-tunnel-ng :

      npm install global-tunnel-ng