6

I implemented a GCM push notification service that runs on my computer (at least during development).

To do that, I basically format and send requests to https://android.googleapis.com/gcm/send.

For authentication, I obviously used a server key I generated on the Google Developers console.

I tested it and it works perfectly (the devices receive the push notification, and it's actually damn fast).

I send those push notifications several times in the day, but yesterday I faced a situation were the request sending returned a 401 (which stands for authentication required). My request was exactly the same as usual. I retried 4 times with the same result then suddenly, it worked again and returned a 200.

I'm at loss trying to understand why this happens. According to this documentation, 401 is only supposed to happen if:

  • Authorization header missing or with invalid syntax.
  • Invalid project number sent as key.
  • Key valid but with GCM service disabled.
  • Request originated from a server not whitelisted in the Server Key IPs.

None of these conditions have changed between the different calls.

Is there some kind of threshold or quota that might explain this ? Or is there a guideline regarding what to do when this happens ?

ereOn
  • 53,676
  • 39
  • 161
  • 238
  • 1
    Do you have a proxy/firewall in your network? Did you trace your calls using a network analyzer like wireshark? This 401 call may come from a firewall or proxy in your path to google servers especially you are in an controlled network environment like enterprise. – Atilla Ozgur Mar 14 '14 at 22:11
  • @AtillaOzgur: We all work from home (and so have different networks, Internet providers) but we all faced the same issue so likely not the cause sadly. – ereOn Mar 15 '14 at 12:08
  • can you add example network trace when error occurs? – Atilla Ozgur Mar 15 '14 at 12:13
  • We're seeing the same problem here. Several different network connections, all white-listed, and all receive intermittent 401s. – Jake Braun Apr 01 '14 at 18:59
  • Same issue for me. First request gets succeeded, next request failed. Did you found the root cause? – anandaravindan Dec 19 '15 at 02:38

0 Answers0