0

I want to use Firebase Cloud Messaging (FCM) in my Laravel app. I should add the FCM server_key and sender_id to my .env file, but there are multiple server keys in my FCM settings :

enter image description here

Also there is the current api key in google-services.json file and web API key in general settings.

I tried using all of them, but every time I get this error :

enter image description here

I also tried writing the server key and sender id between " " in .env file but it doesn't work.

How can I fix it ??

AL.
  • 36,815
  • 10
  • 142
  • 281
Rowayda Khayri
  • 489
  • 1
  • 9
  • 21
  • 1
    Ignore the API keys in the *google-services.json* file. It's not used for FCM (see [here](https://stackoverflow.com/a/40358530/4625829)). Could you try sending a [simple downstream message](https://stackoverflow.com/documentation/firebase-cloud-messaging/8242/firebase-cloud-messaging#t=201705250241240965417) using each of the Server Keys (except the *Legacy* Server Key, as much as possible, don't use it anymore). Also, could you post the related code snippets (excluding the sensitive data)? – AL. May 25 '17 at 02:42
  • I'm using this package: [https://github.com/brozot/Laravel-FCM](https://github.com/brozot/Laravel-FCM) I tried a downstream message with postman and all the 3 keys in the cloud messaging tab are working and return message_id. But in postman I should add ' key= ' before the server key to work .. but this doesn't work in .env file ! @AL. – Rowayda Khayri May 25 '17 at 03:24
  • Hi Rowayda. If FCM worked using Postman, it seems that the issue could be with the package you're using. I suggest filing an issue there as well. – AL. May 25 '17 at 04:00

0 Answers0