I am trying to implement Firebase Cloud Messaging into a Web App. I am following this guide from Google. I have already implemented the client side and I want to subscribe my client to a topic with the token my client sends to my server. The guide says subscribing is done over the Instance ID API from google.
The problem is that the Instance ID API only returns "401 Unauthorized" when I provide my Firebase API-Key in the Authorization header and "403 forbidden" when I pass my Cloud messaging Server-Key as Authorization.
Here is one of the calls I tried from Postman
POST /iid/v1/{{CLIENT_TOKEN}}/rel/topics/movies HTTP/1.1
Host: iid.googleapis.com
Authorization: key={{API_KEY}
Content-Type: application/json
Content-Length: 0
Cache-Control: no-cache
Postman-Token: 3cb43dd8-bc27-4fab-b97b-c5ef583c4191
In the Code snippet I have omitted the CLIENT_TOKEN and the API_KEY. the token is the token received from calling messaging.getToken()
on the client.