1

On my web project was used old GCM messaging, I migrate it to new FCM

I'm changed code on server for sending requests to https://fcm.googleapis.com/v1/projects/{my-project-id}/messages:send.

I'm changed fronted JavaScript code for pushManager.subscribe, I add applicationServerKey, goten from firebase Web Push certificates Public key, and remove gcm_sender_id from manifest.webmanifest So, now new registration tokens is getting successfuly and saved on my server.

NOW When I send notification message to old registration tokens, goten when I used GCM and gcm_sender_id, it is successfuly sended without errors. BUT if I send notification message to new registration tokens, I always get error with code 403 Forbidden and text error SENDER ID MISMATCH

I understand that senderId is a project-id in Google Cloud console and it is must be the same project-id in Firebase project, and this is actualy equal, and connected to one account.

I was trying to configure new project in Google Cloud console and new project in Firebase but nothing help, I was getting the same error.

What I made no right?

Sim
  • 31
  • 3

1 Answers1

2

Solved!

the problem was in:

I used pushManager.subscribe but this was wrong!

For firebase subscription it is need to use firebase-app.js, firebase-messaging.js and messaging.getToken()

Ram Chander
  • 1,088
  • 2
  • 18
  • 36
Sim
  • 31
  • 3