10

where does the server key go when using firebase nodejs sdk.

I'm getting the error messaging/authentication-error, message: 'An error occurred when trying to authenticate to the FCM servers. Make sure the credential used to authenticate this SDK has the proper permissions.

however my sdk works in when handling authentications, so it's definitely initialized just not for messaging.

Luke
  • 139
  • 1
  • 6
  • Have you reviewed this [setup guide](https://firebase.google.com/docs/admin/setup#add_firebase_to_your_app)? – Bob Snyder Oct 24 '17 at 04:58
  • @BobSnyder yeah i'm currently running firebase authentication and that works fine so admin is initialized. – Luke Oct 24 '17 at 09:36
  • solved it....... I updated my sdk to a new one which came out 12 hours ago and generated a new private key – Luke Oct 24 '17 at 11:03

2 Answers2

18
  1. Go to GCP Dashboard in your project;
  2. Search API and Service;
  3. In the Enable APIs and Services section, click +Enable APIs and Services, and search cloud messaging;
  4. Now go to Cloud Messaging and Firebase Cloud Messaging API one by one and enable it.
Arslanbekov Denis
  • 1,674
  • 12
  • 26
Shubham Gupta
  • 183
  • 1
  • 8
  • I want to comment that with new Firebase projects, only the new FCM API (v1) is enabled by default, with the legacy ("Cloud Messaging" API) being disabled by default. With that setup I always got auth error `PROJECT_NOT_PERMITTED` when trying to use the official `firebase-admin` Javascript library. I had to also enable the legacy API - as this answer does, or by using the Firebase console -> Project Settings -> Cloud Messaging -> Cloud Messaging API (Legacy) -> menu -> Manage API -> Enable. – Guss Sep 08 '22 at 09:10
0

Go to google cloud then go to API and Services then Enabled API and Services then turn on the cloud messaging Turn on Firebase cloud messaging API.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 19 '22 at 01:40