user351711
user351711

Reputation: 3301

Adding Google GCM Api Key Azure Notification Hub Error

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?

Upvotes: 4

Views: 5147

Answers (4)

Y8sy
Y8sy

Reputation: 245

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.

Upvotes: 3

PEO
PEO

Reputation: 195

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. enter image description here

Upvotes: 2

Ajay Takur
Ajay Takur

Reputation: 6236

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

Upvotes: 0

CrusherJoe
CrusherJoe

Reputation: 141

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

Upvotes: 8

Related Questions