简体   繁体   中英

Google Cloud Messaging Unauthorized

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM