Android GCM Unauthorized Error 401 with PHP

Recently, my GCM push message notification no longer worked. I didn’t change anything; in my Google API console, I registered IPV6 of my dedicated server if the IP address is white list.

But when I try to get to the GCM service, I always get the error message:

Unauthorized

Error 401

Also tried with IPV4 without success ...

I tried the same script on my own computer and everything works smoothly ...

Any idea would be greatly appreciated :)

thanks for the help

+6
source share
4 answers

You need to put the IP address of the server in the whitelist IPs in the google api console for GCM.

Edit: you should use Key for server applications (with IP blocking) instead of the browser key.

+4
source

I had the same problem for one whole day! but it’s stupid for me ... in the developer console> API and auth> make sure your "Google Cloud Messaging Service for Android" is turned on! That was my fault. As well as the first test, resolving all IP addresses.

+2
source

I had the same problem. For me, this allowed me to register my public ip, waiting a few minutes, and then updating the google api console page.

0
source

I had the same problem and in the end I added "0 :: 0/0" to my white ip addresses. This posed a problem for me. Although the best solution would be to get real IPV6 for use on the server.

0
source

Source: https://habr.com/ru/post/947532/


All Articles