0

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?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Please contact https://firebase.google.com/support/contact/troubleshooting/ – Diego Giorgini Sep 10 '16 at 21:37
  • Thank you, I have contacted. How long time need google for answer? Do you know that? – Rudolf Bär Sep 10 '16 at 22:50
  • Have you tried generating a new API Key from the Developer's console? See my [answer](http://stackoverflow.com/a/37801206/4625829) here for the steps. After generating, check in the Firebase Console if the project was able to recognize it automatically. – AL. Sep 11 '16 at 12:59
  • Yes I have tried. No server api key works. – Rudolf Bär Sep 12 '16 at 07:49

2 Answers2

1

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.

0

Try replacing:

con.setRequestProperty("Authorization: key", "<YOUR API KEY>");

with:

con.setRequestProperty("Authorization", "key=<YOUR API KEY>");

firebase (fcm) says 401 unauthorized

Community
  • 1
  • 1
  • Thank you but it doesn´t work. I have also create a new test project and this works fine. I can´t change the project because I have a lot of peoples with older version. – Rudolf Bär Sep 10 '16 at 19:37
  • In a new test project but not in my main project. This is my problem. – Rudolf Bär Sep 10 '16 at 22:49