yesterday I implemented an Android test app on basis of Google's quickstart sample. Sending notifications using the Firebase console worked immediately. But now I want to send a notification using curl. I tried
curl -X POST --header "Authorization:key=AIzaSyAt-ZnG3..." --header "Content-Type:application/json" https://fcm.googleapis.com/fcm/send -d "{\"anydata\" : \"blabla\"}"
I always get an Error 401 = Unauthorized as response.
In other questions I read something about a server key which I cannot find anywhere. I use the api key out of the provided google-services.json file.
I also added a space character between 'Authorization:' and 'key' and tried many other things I don't remember.
Questions:
- Do I have to enable anything in Firebase's console?
- Is there a problem with the quotes in the curl statement in Linux? Maybe they are removed by the shell before sending?
- Anything else?
Please help me, otherwise I have to investigate for an alterative push notification provider and learning starts again, but I have no time left anymore.
Kind regards, Uwe