I'm implementing sending push notifications from my google-app-engine server to client apps. I'm receiving response 401 when sending post message to Firebase cloud messaging server (https://fcm.googleapis.com/fcm/send). I've followed instructions in https://firebase.google.com/docs/cloud-messaging/server, so I'm sending "Authorization" header with my server key. When I'm checking for validity of the key with curl:
curl --header "Authorization: key=$api_key" \
--header Content-Type:"application/json" \
https://fcm.googleapis.com/fcm/send \
-d "{\"registration_ids\":[\"ABC\"]}"
I'm getting response:
{"multicast_id":6193339963814546500,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
Which should mean that my server key is valid. I followed "Recommended Actions" for 401 described in: https://firebase.google.com/docs/cloud-messaging/http-server-ref Apart from the last one: "Request originated from a server not whitelisted in the Server key IPs." Can that be the cause? How to check that?