6

I'm creating a Xamarin project to test Azure Notification Hub, but I'm having trouble going through the steps in this article

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.

Can anyone shed a light on how to obtain an Api key for Azure Notification Hub?

  • 3
    I've raised this as an issue on GitHub for them to update their documentation, as I agree it's outdated: https://github.com/MicrosoftDocs/azure-docs/issues/95498 – Reisclef Jul 08 '22 at 09:05

3 Answers3

7

expanding DrDave's comment

From 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
  • Follow the offered link to manage in google cloud console, and there press the button to enable the googlecloudmessaging API
  • Wait a few minutes
  • Go back to your Firebase console Cloud Messaging Tab, and refresh.
  • See that the Cloud Messaging API header has changed to "Cloud Messaging API (Legacy) ✅ Enabled" and that a Server Key is now shown.

Warning:

This whole approach stops working in June 2024 and we depend on the NotificationsHub team to address this, as per https://github.com/MicrosoftDocs/azure-docs/issues/93522#issuecomment-1600272887

Chris F Carroll
  • 11,146
  • 3
  • 53
  • 61
1

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. EDIT: This is not the proper key for the Azure Notification Hub. See my comment below for the correct key.

DrDave
  • 26
  • 5
  • 1
    The key mentioned in my original answer above will not connect FCM to Azure Notification Hub. In order to connect, you will need to enable the Cloud Messaging API (Legacy) on the Cloud Messaging tab. Once you do that, you will see the Server Key for that API. That is the key that should be entered into the Azure Notification Hub. – DrDave Jun 10 '22 at 13:41
  • 4
    I thought that was the legacy (soon to be deprecated) way of connecting to the API. The title says "Cloud Messaging API (Legacy)" which is GCM not FCM. Am I missing something? – Shant Hagopian Jun 10 '22 at 22:19
1

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.

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.

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.

sdb
  • 109
  • 5