0

I have been using Google Cloud Messaging to send messages to my phone via php pages on my permanently on server (a Raspberry Pi) successfully for some time. In that old app I used a browser key with no restrictions and not a server key.

I was aware that GCM should be migrated to Firebase Cloud Messaging (FCM) and have successfully done this. During development both FCM and GCM apps were working. Recently my GCM app returns Unauthorized (401) errors to my server. I know that FCM will only give out restricted server keys now and that unrestricted keys are not issued.

I am surprised that my old app developed before FCM even existed has stopped working. I assume that the message sent from my server to Google is being rejected by them.

Am I correct in my assumption that old GCM browser keys will always be rejected by Google?

AL.
  • 36,815
  • 10
  • 142
  • 281
NickT
  • 23,844
  • 11
  • 78
  • 121

1 Answers1

2

Am I correct in my assumption that old GCM browser keys will always be rejected by Google?

Yes. As of right now, GCM and FCM will only accept Server Keys.

Using any other type of API Keys (Android, iOS, Browser) will result in a 401 error. One example of this is this post, the OP originally had an Android Key and it started to return a 401 error.

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281
  • Thanks for your quick answer. I hadn't been testing the old GCM whilst doing other work but my evidence suggested that browser keys were broken now. It's a good job I have migrated to FCM. This is actually p*** poor behaviour on Google's part in breaking the functionality of old apps. Many people will be relying on the old functionality. – NickT Nov 07 '16 at 10:43
  • @NickT It was just a sudden change and there were a lot of users affected. However, I think the expected API key to use for the GCM service has always been a Server type key, since it is being used in the Server. Good catch on implementing FCM asap anyways. :) Cheers! – AL. Nov 07 '16 at 11:10
  • @NickT Btw, I think my answer is pretty much what you are looking for. If you agree, do mark it as accepted so that your post will be properly tagged. Cheers! – AL. Nov 08 '16 at 06:52