I\'m trying to test out Firebase Cloud messaging APIs as all functionality is not available from console (notably customization of notifications when app is in background).
I faced the same problem.
the problem was that I was using the legacy server key. when I used the new version of the server key the problem solved.
in your firebase console goto settings -> cloud messaging
then use the new server key. it is longer than the old version key.