Skip to content

Conversation

kroikie
Copy link
Contributor

@kroikie kroikie commented Feb 20, 2022

No description provided.

@kroikie kroikie changed the title add manage FCM tokens sample [WIP] add manage FCM tokens sample Feb 20, 2022
@puf
Copy link
Contributor

puf commented Feb 20, 2022

Nice!

I often refer to this code in the FCM sample on how to prune tokens while sending. Is it necessary to use both approaches, or would one or the other suffice?

If both are needed, can you make sure we link them to each other?

@egilmorez
Copy link
Contributor

Not to pre-empt a response from Arthur, but I'd say that we are indeed recommending the use of multiple approaches to maintain token health. The sample you cite Puf -- and thanks, because I think I can use it if we add some start/end tags -- pertains to this approach I think: https://firebase.google.com/docs/cloud-messaging/manage-tokens#detect-invalid-token-responses-from-the-fcm-backend

General comment for Arthur: can you add those tags if appropriate, and also tag the other two functions in your index.js? Thanks!

* Note: Most FCM registration tokens would be associated with a user. In that case
* there should be some mapping between the user and the token(s) when stored.
*/
exports.updateToken = functions.https.onCall(async (data, context) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kroikie what do you think about making this a Firestore trigger instead of a callable? Reasoning is that then the writes to Firestore can be protected by Security Rules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants