Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Cloud Messaging API Key

Tags:

Any way to regenerate the API Key for FCM (Cloud Messaging section) in Firebase Console? The key is not editable and is different from the one automatically generated in Google APIs Console. Due to this misconfiguration I'm always getting unauthorized 401 from FCM...

like image 730
Jumpa Avatar asked Jun 09 '16 18:06

Jumpa


People also ask

How do I get Firebase Cloud Messaging API key?

In the Firebase console, open Settings > Service Accounts. Click Generate New Private Key, then confirm by clicking Generate Key.

Where is Firebase authentication key?

Click the Settings (Cog wheel) icon next to your project name at the top of the new Firebase Console, as per screenshot below: Click Project settings . Click on the Cloud Messaging tab. The key is right under Server Key .

How do I find my API key?

Go to the Google Maps Platform > Credentials page. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key. Click Close.


1 Answers

Update: Even with the new UI of the Cloud Messaging Tab where the FCM Token is visible, the Regenerate Key button would still be visible if the Server Key was deleted.

enter image description here


Update: It seems it is now possible to regenerate the Server Key via the Firebase Console, however, the label/button (see screenshot) only shows up when there is no Server Key being used.

enter image description here

After clicking on Regenerate Key, it will generate a new Server Key which is also visible in the Google Developers Console.


Still no way to re-generate the API Key from Firebase Console. HOWEVER, I was able to re-generate it via the Developer Console.

I went through the consoles again after having a discussion with @SarthakMishra and was able to actually re-generate the API Key found in the Firebase Console.

First, I'll provide the steps on getting to the part where to actually see the current Server Key.

  1. Select your project via the top-rightmost side.
  2. Then on left-side panel, click on the gear button and select Project Settings.
  3. Then go to the Cloud-Messaging Tab

From there, you will be able to see the Server Key and the Sender ID.


Here are the steps to re-generate the Server Key. Go to your Developer Console.

  1. On the top-rightmost side, select the project name that corresponds to your Firebase Project.
  2. On the left-side panel, click on Credentials .

After that, you will be able to see the API Keys currently available for the project. Commonly, you will see two API Keys. One Server Key and one Android Key, where it has a label beside it saying (auto created by Google Service). Click on the Server Key.

  1. Click on Regenerate Key . A prompt like this should show up:

Do you want to replace the current key with a new one?

The new key will be available immediately. The current key will be deactivated permanently in 24 hours.

  1. Click on Replace key .

After that, you will see the new Server Key generated. Go back to the page where you can see the Server Key and Sender ID and refresh it. It should match the new Server Key generated.

like image 85
AL. Avatar answered Sep 29 '22 06:09

AL.