Reputation: 11
I have deleted my api key named "Server key (auto created by Google Service)" from an imported Google project in Firebase.
Now the field server key in project settings - cloud messaging is empty. Also I can´t send a notification, I get an unauthorized 401 error from server.
What I can do?
Upvotes: 0
Views: 2422
Reputation: 11
I have solved! Google support writes me a workaround for this problem.
1) Create an sample Android Application in your Firebase project. 2) Download the google-services.json 3) Go back to your Firebase Project Settings > Cloud Messaging Tab, refresh the page, then you should be able to see your Server Key in there.
After this steps you can delete the created Android Application. The key is visible in Cloud Messaging Tab.
Upvotes: 1
Reputation:
Try replacing:
con.setRequestProperty("Authorization: key", "<YOUR API KEY>");
with:
con.setRequestProperty("Authorization", "key=<YOUR API KEY>");
firebase (fcm) says 401 unauthorized
Upvotes: 0