1

I'm migrating to the FCM v1 API (https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages) from the legacy API (https://firebase.google.com/docs/cloud-messaging/http-server-ref) to send push notifications.

I want to know if is there some way to retrieve the canonical_id related to the token (registration_id) just like in the legacy API.

I have found nothing about it in the docs, only that the result is a Message object, and if an error occurs it returns a FcmError Object.

If I can't retrieve the canonical_id I think I would end up receiving errors of invalid / not registered token after some time (or am I wrong?), and would have to invalidate them in my database, if the user doesn't use the app during a reasonable amount of time.

AL.
  • 36,815
  • 10
  • 142
  • 281
Lucas Basquerotto
  • 7,260
  • 2
  • 47
  • 61

1 Answers1

1

AFAICT, canonical_ids haven't been used since the legacy api. See my answer here.

Registration tokens don't get invalidated on a regular basis, just on a few scenarios, where onTokenRefresh() is actually called and thus must be handled on the client side (resend the new token towards your server).

AL.
  • 36,815
  • 10
  • 142
  • 281