Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Cloud Messaging replaced the server keys with Tokens for sending notifications/messages

I am developing a demo app using Firebase Cloud Messaging. However, I am facing issues with the Firebase server key. Today morning I noticed that my server key got replaced with the FCM tokens.

Screenshot : FCM Token replaced server key

I was having two different FCM projects in two Gmail accounts having same package name for the Android app. I thought this may be causing issue and I have deleted both the projects and changed the package name, but still no luck.

I am unable to receive the push to my device. I have researched about the issue but didn't find any solution.

like image 270
Faisal Shaikh Avatar asked Nov 16 '16 07:11

Faisal Shaikh


People also ask

Where is the server key for Firebase Cloud Messaging?

In the Firebase console, open Settings > Service Accounts. Click Generate New Private Key, then confirm by clicking Generate Key. Securely store the JSON file containing the key.

What is token in Firebase Cloud Messaging?

On initial startup of your app, the FCM SDK generates a registration token for the client app instance. This is the token that you must include in targeted send requests from the API, or add to topic subscriptions for targeting topics.

Does Firebase FCM token change?

FCM token for an app may change due to various reasons that are specified in the Firebase documentation.

Does FCM server key expire?

It doesn't expire though. It renews itself if one of the following happens. According to https://firebase.google.com/docs/cloud-messaging/android/client: -The app deletes Instance ID.


2 Answers

I checked the Firebase release notes, but can't find any roll out regarding this change. However, looks like the server key will be deprecated soon and will be replaced by the FCM token.

If you're having issues using the server key, then consider using the FCM token now.

Basically, you'll just need to change the value of the authorization key in the request header when sending messages to client apps.

Content-Type:application/json   
Authorization:key=XXXXXXXXX:APA91bHVdTcAQGdFc5bIyK_WExwd5U6uJ....
like image 134
looptheloop88 Avatar answered Nov 15 '22 03:11

looptheloop88


Looks like that they re-use the server key term instead of FCM token, just upgraded to the newer version, as the following screenshot:

enter image description here

like image 36
BNK Avatar answered Nov 15 '22 04:11

BNK