简体   繁体   English

Firebase 云消息 (FCM) Api Azure 通知中心的密钥

[英]Firebase Cloud Messaging (FCM) Api Key for Azure Notification Hub

I'm creating a Xamarin project to test Azure Notification Hub, but I'm having trouble going through the steps in this article我正在创建一个 Xamarin 项目来测试 Azure 通知中心,但我无法完成本文中的步骤

Under the section " Create a Firebase project and enable Firebase Cloud Messaging " Step 6 is obsolete as Google seems to have changed their model to obtain a Server Key , or the Server Key does not apply to FCM.在“创建 Firebase 项目并启用 Firebase 云消息”部分下,第 6 步已过时,因为 Google 似乎已更改其 model 以获取服务器密钥,或者服务器密钥不适用于 FCM。

Can anyone shed a light on how to obtain an Api key for Azure Notification Hub ?谁能阐明如何为 Azure 通知中心获取 Api 密钥

There currently does not seem to be a proper answer to this.目前似乎没有正确的答案。

When using FCM, if you head to the Authentication page on the Firebase Console for your app and select 'Get Started', follow the steps and then head back to the 'General' tab in your project settings page, you will see that it now has a Web API key.使用 FCM 时,如果您前往应用的 Firebase 控制台上的身份验证页面和 select“开始”,请按照步骤操作,然后返回项目设置页面中的“常规”选项卡,您现在会看到它有一个 Web API 密钥。

This isn't useful for Azure Notification Hubs as if you try insert this key into the API key entry for a hub, it will not accept it.这对 Azure 通知集线器没有用,因为如果您尝试将此密钥插入集线器的 API 密钥条目,它不会接受它。

The only answer seems to be to use the legacy GCM API, which is not ideal as it has been deprecated and certain APIs are no longer available.唯一的答案似乎是使用旧版 GCM API,这并不理想,因为它已被弃用并且某些 API 不再可用。

If you go to the Build section, Authentication menu item, and then click the 'Get Started' button, then navigate back to the Project Settings/General tab, you should see the API key.如果您转到 Build 部分,Authentication 菜单项,然后单击“Get Started”按钮,然后导航回 Project Settings/General 选项卡,您应该会看到 API 密钥。 EDIT: This is not the proper key for the Azure Notification Hub.编辑:这不是 Azure 通知中心的正确键。 See my comment below for the correct key.请参阅下面的评论以获取正确的密钥。

expanding DrDave's comment扩展 DrDave 的评论

From https://console.firebase.google.com/project/--your_project_name--/settings/cloudmessaging来自https://console.firebase.google.com/project/--your_project_name--/settings/cloudmessaging

  • Click on the three-dots menu of the " Cloud Messaging API (Legacy) Disabled " Heading点击“ Cloud Messaging API (Legacy) Disabled ”标题的三点菜单
  • Follow the offered link to manage in google cloud console, and there press the button to enable the googlecloudmessaging API按照提供的链接在谷歌云控制台中进行管理,然后按下按钮启用 googlecloudmessaging API
  • Wait a few minutes等几分钟
  • Go back to your Firebase console Cloud Messaging Tab, and refresh. Go 返回您的 Firebase 控制台云消息选项卡,然后刷新。
  • See that the Cloud Messaging API header has changed to " Cloud Messaging API (Legacy) ✅ Enabled " and that a Server Key is now shown.看到 Cloud Messaging API header 已更改为“ Cloud Messaging API (Legacy) ✅ Enabled ”,并且现在显示了一个服务器密钥

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM