Android developers reporting GCM/FCM Sever Keys returning 401 errors

3,031 views
Skip to first unread message

geo...@onesignal.com

unread,
Sep 17, 2016, 12:24:22 PM9/17/16
to Firebase Google Group
Many of our clients are reporting 401 Unauthorized errors for GCM/FCM Server keys that previously worked without issues.

There is a steep increase in StackOverflow threads that point to this being due to an issue in the new changes for the Credentials page in the Google Cloud Console.

There are a bunch of reported workarounds, with lots of random reports of them working or not working. 

It seems some change was made to how these keys must be created. However it's unclear why previously generated keys would have suddenly stopped working, nor precisely which key generation methods are now correct or incorrect. 

Relevant threads and content:



Sept 14, 2016: unauthorized in the gcm "A:  At the bottom of the page you could add whitelisted IP's/ranges."

Sept 14, 2016: Android Device is not receiving Urban Airship Push Notification "A:  I would still suggest contacting Urban Airship for a server IP Address that you can add in the restrictions."

Sept 12, 2016: Android - GCM server key is not working with Urban Airship "API key 4 is recently created but it is not working the Server Key created on June 9th works fine." "Seems that Google is no longer authorizing the API Keys created by Google API Console."

Sept 13, 2016: Bluemix push notification for android is not sending any notifications "I tried to create a new project on GCM, and it suddenly started to work." "Can you please run a new test by creating a new API and a new API Key? I believe Google made some changes to the GCM, and what I get is different from yours."

Sept 10, 2016: Firebase Cloud Messaging No Server Key "I have solved! Google support writes me a workaround for this problem. 1) Create an sample Android Application in your Firebase project. 2) Download the google-services.json 3) Go back to your Firebase Project Settings > Cloud Messaging Tab, refresh the page, then you should be able to see your Server Key in there. After this steps you can delete the created Android Application. The key is visible in Cloud Messaging Tab."

ja...@onesignal.com

unread,
Sep 19, 2016, 4:20:58 PM9/19/16
to Firebase Google Group
We had the opportunity to perform remote screen sharing support for one of our clients. Here's a summary of what we learned:

- Their Google Server API Key, created months ago, got a 401 Unauthorized error about 4 days ago and no longer works
  - They showed us that the Google Cloud Messaging project API was enabled
  - They showed us that the key had no restrictions
- Creating a new key via Google's Cloud Console UI actually did not work:
  - Steps:
    - 1. Visit console.cloud.google.com and visit the API dashboard.
    - 2. Make sure Google Cloud Messaging is enabled in the Library tab.
    - 3. Visit the Credentials tab, click "Create credentials", click "API Key", and copy and use the key as-is without any restrictions.
  - Following the steps above, the key still had a 401 Unauthorized error
- Following the instructions here on our documentation seems to generate a valid working key (these steps work for web push as well)
  - In step 1.3, our client tried using an Android package name of "Push.Notification" for his key; the resulting generated key actually did not work and got a 401 Unauthorized error
    - We tried step 1.3 again using an Android package name of "test.test"; the resulting generated key worked successfully

Kato Richardson

unread,
Sep 19, 2016, 5:40:50 PM9/19/16
to Firebase Google Group
Hi Jason, George,

Looking into this; thanks for letting us know. Ping me off-list if you also submitted this via support so I can link the discussions.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/c1fed6ba-a784-4988-9115-4817a520a4a6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Skyler Shaw

unread,
Sep 20, 2016, 9:43:44 AM9/20/16
to Firebase Google Group
Hi all 👋, Skyler here with Intercom. We've also noticed a massive increase in push failures on existing GCM keys added to our platform since Sunday evening UTC. Additionally, no newly generated GCM keys are working when created at https://console.developers.google.com/apis/credentials. This appears to have coincided with a process/UI change on the page. We've attempted validating failing keys using a variety of GCM/FCM endpoints without success. Similar to the crew at OneSignal, we've found the GCM wizard: https://developers.google.com/mobile/add?platform=android&cntapi=gcm and FCM console: https://console.firebase.google.com/ to create keys that work as expected.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Kato Richardson

unread,
Oct 17, 2016, 7:17:08 PM10/17/16
to Firebase Google Group
Thanks for the additional details, Skyler.

George:  Those issues seem to have shaken out to different root causes--incorrect plist files, missing config options, et al. Not seeing a common thread and not seeing much in our support channels on the topic.

Note that you should be going to the Firebase console for all FCM keys. (note that's not the cloud console)

It looks like there was an issue a while back where previous browser keys and in some cases other non server keys were working, even though they should not have, to send FCM messages. This may account for some of the unexplained key-related issues. If that's the case, then ensuring you are using server keys from the Firebase console should resolve this.

I know this is a bit late and that it's not a solid and simple fix, but we've spent some time on these and haven't come up with much here.

☼, Kato
Reply all
Reply to author
Forward
0 new messages