Sinki Agarwal
Sinki Agarwal

Reputation: 11

GCM Server API Key Unauthorized (401)

The GCM API has suddenly started throwing an Unauthorized (401) error. A lot of answers suggest using Server key instead of an Android key, but we are already doing that.

Also the Allowed IPs field is left blank. The key was working until a couple of days ago it suddenly started throwing a 401 error.

We have also tried regenerating a new key, but it still throws a 401. Any help would be greatly appreciated.

Upvotes: 1

Views: 513

Answers (1)

abielita
abielita

Reputation: 13469

Found a related thread to your issue. Maybe you had the server key configured in your Android project and was creating new Sender(SERVER_KEY) with it. Clearly the server key must be configured in the appengine project (with GCM messaging enabled). Otherwise it may still work, however there must be different quotas or something, which causes 401 after several days of using.

You can also try the answer here that suggests to whitelist the IPv6 address. If you want only IPV4, add this to your curl php init: curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );.

Check these related links:

Hope this helps!

Upvotes: 1

Related Questions