0

I'm trying to get a list of topics subscribed to via the firebase API.

My firebase project has an api-key, which is known to the client. The client has also generated a messaging-token (which I guess is really a google iid). So both are public information.

I am attempting a GET to the following url (based on these google iid instructions)

https://iid.googleapis.com/iid/info/<messaging-token>?details=true&Authorization:key=<api-key>

I also have a header Authorization:key=<api-key> as the instructions are little ambiguous

I am getting 401 responses.

I have done this a few months ago but then I had to provide a secret server key, which the firebase UI described as legacy then, and which is now not available. There is a private key in the UI but that also results in 401s.

screenshot of firebase UI

What do I need to do?

Simon H
  • 20,332
  • 14
  • 71
  • 128
  • On the server side, the App Default Credentials should suffice for authentication and the auth should be baked in to the server-side Firebase Admin SDK library you use, right? [It says](https://firebase.google.com/docs/cloud-messaging/manage-topics) `The Firebase Admin SDK allows you to perform basic topic management tasks from the server side.` – Ronnie Royston Dec 27 '22 at 18:06
  • Yes, I have read this but it among the 'basic' tasks does not seem to be get all my subscriptions – Simon H Dec 27 '22 at 18:22
  • What server environment are you using to get the list of subscriptions – Ronnie Royston Dec 27 '22 at 21:22
  • None as yet. I'm trying to understand the docs to know what secret information, if any, is needed to get these subscriptions, so that I can work out how to architect it – Simon H Dec 28 '22 at 06:41
  • I see. Well, I can tell you that the raw REST API is going to be the most time consuming and complicated approach. The client libraries are the way to go. – Ronnie Royston Dec 28 '22 at 15:39
  • yes, but the client libraries only support "basic topic management" and I need something that is not included, so I need to find another solution – Simon H Dec 28 '22 at 16:13
  • 1
    Does this answer your question? [Get all subscribed topics from firebase cloud messaging](https://stackoverflow.com/questions/37987821/get-all-subscribed-topics-from-firebase-cloud-messaging) – Ronnie Royston Dec 28 '22 at 16:37
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/250715/discussion-between-simon-h-and-ronnie-royston). – Simon H Dec 28 '22 at 17:34

0 Answers0