Azure Notification Hub no longer accepting GCM API Key

寵の児 提交于 2019-12-04 15:54:34

问题


Recently, every time I try to add or modify the GCM API Key in an Azure Notification Hub, I get the following error:

SubCode=40000. Failed to validate credentials with GCM. The remote server returned an error: (401) Unauthorized...

I have tried using the same key that works in other Notification Hubs, as well as creating a new one via the Google Developer's console.

I've also recently come across articles stating that GCM is moving to FCM (Firebase Cloud Messaging). Could this be the cause of my issue? Is Google beginning to no longer support GCM?


回答1:


There are two important informations:

  • Firebase Cloud Messaging (FCM) is the new version of GCM

So we should prefer Firebase Console instead of Google Cloud Console,

  • There is a useful article here Enabling Google Cloud Messaging (Firebase)

So we need to enable Google Cloud Messaging in Firebase Console for your added Android App.

Step by step:

-- Open your Firebase Console

-- Add your Android app in Firebase Console.

-- Go to Settings

-- Click CLOUD MESSAGING tab.

-- Take Legacy Server key there and use it in Azure Push Notification Service for Google(GCM) settings and Save it. That's all.

This article helps you how to create a Notification Hub Service in Azure then how to connect your Android or IOS App to Firebase Console etc.




回答2:


Could you make sure that 1) you have enabled Google Cloud Messaging for Android in your cloud push account and 2) you are creating a new Server Key?

Also, use try sending a push notification from the command line to validate that the key is working with GCM directly. If that works, then Azure portal should accept the key. If that's not the case, please leave a comment.



来源:https://stackoverflow.com/questions/39379532/azure-notification-hub-no-longer-accepting-gcm-api-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!