Firebase错误-来自此ios应用程序<empty>的请求被阻止

Dav*_*vid 5 api ios cordova firebase ionic-framework

我们正在开发带有Firebase的Ionic App。这是一个与Ionic v1一起运行的旧项目。我们正在构建phonegap:

PhoneGap (iOS / Android / Windows)
cli-7.1.0 (4.5.4 / 6.3.0 / 5.0.0)
Run Code Online (Sandbox Code Playgroud)

一切正常,并发布了我们想要确保访问Firebase的应用程序。

为了保护对Firebase的访问,我们限制了Google开发者控制台对GoogleAPI密钥的访问,如下所述:

而且我们在使用iOS版本时遇到了麻烦(适用于android)。

我们做了什么 :

  1. 在Firebase项目中创建iOS应用
  2. 导出GoogleService-Info.plist并将其包含在config.xml中:

<platform name="ios">    
   <resource-file src="GoogleService-Info.plist" />
</platform>
Run Code Online (Sandbox Code Playgroud)
  1. 在Google Developer Console中限制访问我们的捆绑软件ID

现在我们有这个错误:

Error : {"error":{"code":403,"message":"Requests from this ios client application <empty> are blocked.","errors":[{"message":"Requests from this ios client application <empty> are blocked.","domain":"global","reason":"forbidden"}],"status":"PERMISSION_DENIED"}}
Run Code Online (Sandbox Code Playgroud)

我已经找了两天,但我不明白:

  • 似乎iOS应用的初始化方式不同,我无法正确传递捆绑软件ID
  • GoogleService-Info似乎在正确的位置,但是,好像没有使用它
  • 在网路上找不到任何有相同问题的人,因此一定是菜鸟的错误...

先感谢您,

大卫

小智 1

我有同样的问题,我检查了GoogleService-Info.plist。数据库 url 与我的项目不同。因此,请确保所有组件都与您的项目相匹配。

这解决了我的问题!