2
votes

I am working on an application that can receive notifications using Google Cloud Messaging. I implemented it following Google's instructions and it worked. For the server side implementation of Google Cloud Messaging, I used a PHP webserver.

I am having trouble switching from webserver. I switched from a http server to a https server. This https server has a different IP address then the http server.

In the Google Developer console, I edited the allowed IP addresses for the server key to the new https server ip. I applied the settings, but now I am getting the following error when trying to send a notification to Google Cloud Messaging:

Unauthorized Error 401

I also tried deleting the server key and regenerating one. When I used this new key in my php code, I got the same error.

I searched StackOverflow for answers. There are a lot of questions containing the unauthorized issue with Google Cloud Messaging. In most of these cases, people were using an android key instead of a server key. Note that I am using a server key already.

Everything has worked, just until I switched IP-address.

What could be the issue here?

1
You can always clear the allowed IP addresses of the server key, so that every IP address will be allowed. Perhaps the new IP address you entered was wrong. - Eran
The IP-address was double checked and is correct. But good to know that I can leave it empty aswell, I'll try that. - Arnout
Okay.. I removed the IP-address and now it works. VERY weird as the entered IP-address was 100% correct. - Arnout

1 Answers

1
votes

I removed the entered IP-address in the Google Developer console so that it is now set to 'Any IP allowed' and now it works. This is very weird, as the IP-address I entered was 100% correct. I'm guessing this is a problem related to Google itself.