GCM API 密钥限制

GCM API Key restriction

我尝试使用离子云发送推送通知,但Google现在需要限制密钥。我不知道如何获得密钥限制。请帮助我。

更新GCM docs中现在有一个可见的注释说:

Starting from Sept. 2016 new server key can only be created in the Firebase Console using the Cloud Messaging tab of the Settings panel. Existing projects that need to create a new server key can be imported in the Firebase console without affecting their existing configuration.


在生成 API 密钥时,Google 开发人员控制台界面最近发生了变化。之前有一个部分你必须 select 它是什么类型(服务器,Android,iOS,浏览器键)。但现在,它会自动创建,然后您可以简单地 select 您想要的限制类型,具体取决于您将在哪里使用密钥。

我以前没有尝试过使用 Ionic,但我认为它与您使用 API 密钥(在本例中为服务器密钥)的位置几乎相同。只需在 IP 地址白名单中设置正确的服务器 IP 地址,然后重试。

请记住,强烈建议您添加限制,以防止未经授权的使用和配额被盗(被视为对 API 密钥无限制的警告) .

查看我的回答here了解更多详情。