gpt4 book ai didi

firebase - 在 Firebase Cloud Messaging 中管理服务器 key

转载 作者:行者123 更新时间:2023-12-04 15:31:47 25 4
gpt4 key购买 nike

我刚刚打开了一个用于 Android 推送消息的 Firebase Cloud Messaging 项目。

齿轮图标显示一个服务器 key (出于显而易见的原因,此处进行了混淆):

enter image description here

我希望拥有多个 key ,因此我可以将它们分发给服务器和开发人员,并在必要时撤销已泄露的 key 。

如何在 Firebase 中管理(添加和删除)服务器 key ?

最佳答案

更新 :

截至目前,为了生成新的服务器 key 应该采取的方式,如 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.



项目迁移步骤见我的回答 here .

对于生成服务器 key ,无法在 Firebase 控制台中生成。可以通过 Google Developers Console 完成:
  • 转到您的 Google Developers Console
  • 在左侧 Pane 中,单击凭据
  • 在凭据选项卡下,单击创建凭据
  • 选择 API key

  • 从我的回答中检索的步骤 here

    选择API Key后,它会直接创建一个API Key,不会询问它是什么类型的(Server、Android、Browser、iOS)。它只会让你设置一些 限制这取决于您打算生成的 API key 。

    默认情况下,生成的 key 有 无限制 ,这使得 key 易受攻击,这就是为什么它是 强烈鼓励为您 添加限制 为您的 API key 。在这种情况下,由于您将其用于 FCM(需要服务器 key ),您必须添加 IP 地址限制并且只允许特定的服务器 IP 地址。

    尽管如此,我不知道您打算如何将多个服务器 key 集成到单个 Firebase 项目中。为什么不直接使用 IP 地址限制 并删除被视为 的服务器 IP 地址受到威胁 ?

    关于firebase - 在 Firebase Cloud Messaging 中管理服务器 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39555928/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com