Foirebase no server key found

456 views Asked by At

My project in FCM has no server key shown in cloud messaging .. only sender ID as shown .. and I am trying to send notification from post man .. so I must have the server key I tried to get the key from the google-services.json file api_key .. current key but it's not working. the code sent in postman is : header: Authorization key="AIzaSyBENvif3XkufbKkjRRE92ECj7RBA0LlWj0" body: "to":"c_OHgeJnQmi_F3i3D7wivZ:APA91bHnvHMI_mR9IWoesWeBOLE1aEXGa-1v-1UVCtt1MriXRo03VcaxxTiBAztnbUOrXCf_AVAqAgyOGBcvK4IsO0cW1o1UNXJQqVpkLKveH0aAPkd7kHvBhUGcGkY--IfBctUvgrR7", "notification" : { "body" : "New announcement assigned", "OrganizationId":"2", "content_available" : true, "priority" : "high", "subtitle":"Elementary School", "Title":"hello" }, "data" : { "priority" : "high", "sound":"app_sound.wav", "content_available" : true, "bodyText" : "New Announcement assigned", "organization" :"Elementary school" can any one help please ?

2

There are 2 answers

0
Mohamed Awad On

I found the solution ... FCM has two ways to send notification 1 - Firebase Cloud Messaging API (V1) 2 - Cloud Messaging API (Legacy) The server key is available on the second way which is disabled by default and must be enabled to get the server key and send notification via API using post man

0
Unna On

Firebase Generate Server-Key 2023

I ran with this issue so this is what i've done

  1. The server key for testing the Cloud messaging is disabled by default
  2. First navigate to the menu of firebase and click Project Settings -> Cloud messaging tab enter image description here
  3. You will find Cloud messaging API disabled enter image description here
  4. click on the dots -> manage API in Google enter image description here
  5. Click on enable 4
  6. Return and refresh the page, you should now be able to copy & test with your server key.