Getting topics a app token in endpooint https://iid.googleapis.com/iid/info/{TOKEN}?details=true

825 views
Skip to first unread message

Rafael Piai Pimenta

unread,
Aug 26, 2024, 1:30:36 PM8/26/24
to Firebase Google Group

I currently use the endpoint https://iid.googleapis.com/iid/info/{TOKEN}?details=true,
to return topics related to the token.

In the header I send the Authorization - key=CHAVE

But this authentication was discontinued by Google, and now according to their documentation, we have to pass OAuth2.

I followed the example: https://firebase.google.com/docs/cloud-messaging/auth-server?hl=pt-br#provide-credentials-manually

and using GoogleCredentials I get the AccessToken and pass it in the request, as per the example:

URL url = new URL(BASE_URL + FCM_SEND_ENDPOINT);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestProperty("Authorization", "Bearer " + getAccessToken());
httpURLConnection.setRequestProperty("Content-Type", "application/json; UTF-8");
return httpURLConnection;

But even after passing this new authentication, I'm getting the following error message:

error='Authentication using server key is deprecated. Please use an OAuth2 token instead.'

Is anyone able to use this endpoint?

Thanks,

Rafael

Rafael Piai Pimenta

unread,
Aug 27, 2024, 12:29:11 PM8/27/24
to Firebase Google Group
In case anyone else has this problem.

The following header was missing: access_token_auth

And the SCOPE informed in GoogleCredentials should be this: https://www.googleapis.com/auth/firebase.messaging

Thanks

Reply all
Reply to author
Forward
0 new messages