Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Invalid Project Id when trying to recover lost group notification key

While testing my server-side php functions to create device groups i lost track of the notification key returned as a result of successfully creating a device group.

As described in https://groups.google.com/forum/#!topic/firebase-talk/ytovugx8XNs i tried

curl -v  -H Content-Type:application/json -H Authorization:key=<your api key> 
-H project_id:<your project id> 
https://android.googleapis.com/gcm/notification?notification_key_name=testgroup

where the project id is the one found in firebase console, the same shown in the url and the very same present even in my google-services.json

As a result i get

HTTP/1.1 400 Bad Request Content-Type: application/json; charset=UTF-8 Date: Tue, 18 Apr 2017 08:21:30 GMT Expires: Tue, 18 Apr 2017 08:21:30 GMT Cache-Control: private, max-age=0 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Server: GSE Alt-Svc: quic=":443"; ma=2592000; v="37,36,35" Accept-Ranges: none Vary: Accept-Encoding Transfer-Encoding: chunked
* Curl_http_done: called premature == 0 * Connection #0 to host android.googleapis.com left intact {"error":"INVALID_PROJECT_ID"}

I can't find a way out of this, since after losing a notification key the only way to recover it is with that command (afaik) . Please help.

like image 786
MaX Avatar asked Jan 23 '26 09:01

MaX


1 Answers

The Project ID that should be used for FCM is the Sender ID. This value can be seen in the Firebase Console > Settings > Cloud Messaging Tab.

If you refer to the google-services.json file, the value for project_number should be the one you use (same value as seen from the Firebase Console). It's a numerical-only value.

like image 106
AL. Avatar answered Jan 25 '26 00:01

AL.