Adding Google GCM Api Key Azure Notification Hub Error

匆匆过客 提交于 2019-12-01 04:34:04

问题


We are trying to add our GCM API key to the azure notification hub and we are receiving the following error:

SubCode=40000. Failed to validate credentials with GCM. Error is The remote server returned an error: (401) Unauthorized...TrackingId:410c0e33-0c38-1823-8a62-2519627c76a2_M1_G19,TimeStamp:9/19/2014 10:08:32 AM

We have setup our GCM API key to allow any IP address and we have also tried registering from code like below but with the same error:

  NamespaceManager mgr = NamespaceManager.CreateFromConnectionString(conn);
  var hub = mgr.GetNotificationHub("<hubname>");


  hub.GcmCredential = new GcmCredential("<apikey>");
  mgr.UpdateNotificationHub(hub);

Are we missing something quite obvious here?


回答1:


SubCode=40000. Failed to validate credentials with GCM.

This will probably fix this error:

Under the SERVICES tab in the APIs console for Google devs:

  • enable Google cloud messaging for android



回答2:


I recently had this problem and what I found was that I needed to go to the new firebase console, import my existing google project.

Once I had done that I could go to the settings cog in the top left->project settings. Then click on the cloud messaging tab then get the new server key. Once I entered that I was good to go in the notification hub.




回答3:


CrusherJoe is 100% correct but if some one need more clear picture here I have attached the screenshot. just go to the link and enable it.




回答4:


Some users may not have verified or registered domain.

With the help of webmaster Tools u can verify and register your domain.

Go to Google Dev Console -> your project ->API's and Auth -> Push -> Click on Learn more for webmaster



来源:https://stackoverflow.com/questions/25931532/adding-google-gcm-api-key-azure-notification-hub-error

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