Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android GCM Unauthorized 401 error with PHP

Recently my GCM push message notification didn't work anymore. I didn't change anything, in my Google API Console, I've registred the IPV6 of my dedicated server if the whitelist IP address.

But when I try to reach GCM service I always get an error :

Unauthorized

Error 401

Also tried with IPV4 without success...

I've tried the same script on my own computer and everything works smooth ...

Any idea would be very appreciate :)

Thanks for your help

like image 584
Bibu Avatar asked Jun 18 '13 08:06

Bibu


2 Answers

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

Edit: you must use Key for server apps (with IP locking) instead of browser key.

like image 180
skygeek Avatar answered Nov 10 '22 03:11

skygeek


i have had the same issue for 1 whole day ! but silly me... in your Dev console>APIs & auth > make sure your "google cloud messaging for android" is ON ! That was my mistake. And also first test by allowing all IPs.

like image 2
spaceMonkey Avatar answered Nov 10 '22 02:11

spaceMonkey