Firebase Cloud Messaging API Key

17,121

Solution 1

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.

Solution 2

You dont need to regenerate the key .Follow the steps

  • Go to the firebase cosole (https://console.firebase.google.com)
  • Select your project
  • On the left hand side , click on the settings icon and select project settings
  • Then Click on the Cloud Messaging Tab
  • You will find your server key there . Use it and you should be good to go
Share:
17,121

Related videos on Youtube

Jumpa
Author by

Jumpa

Updated on June 19, 2022

Comments

  • Jumpa
    Jumpa almost 2 years

    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...

  • AL.
    AL. almost 8 years
    He was asking if there was a way to re-generate the API key via the console, not where to find it.
  • AL.
    AL. almost 8 years
    You did see the Any way to regenerate the API Key in the post, right?
  • Sarthak Mishra
    Sarthak Mishra almost 8 years
    I understand that , but i believe that solving the above mentioned problem is of prime importance for the person who asked the question . And the above steps will solve his/her problem.
  • AL.
    AL. almost 8 years
    Right. But only if he can modify the Server key set for the project or the apps, rather.
  • Sarthak Mishra
    Sarthak Mishra almost 8 years
    The console would obviously provide him the right key , why would he even have to modify the key . Also , which is less likely ..if the key was modified for some reason . He will also find the updated key there
  • AL.
    AL. almost 8 years
    Yup. Confusing if you look at it. Since the post says that the key itself is causing the 401 error.
  • Sarthak Mishra
    Sarthak Mishra almost 8 years
    Actually i ran into the same issue yesterday , what i was doing was i was using the API_KEY instead of the server key . I believe he maybe doing the same mistake !!
  • Sugam Mankad
    Sugam Mankad almost 8 years
    That's what I meant to say buddy @int-j ... When you create an FCM project there is no need to generate the SERVER API KEY, it is already given there.
  • AL.
    AL. almost 8 years
    Yup. I noticed that. But that doesn't really provide a solution.
  • wobsoriano
    wobsoriano about 7 years
    mabuhay ka sir!
  • Ahmad Salman
    Ahmad Salman over 2 years
    Thanks, best answer.

Related