Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] add manage FCM tokens sample #958

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

[WIP] add manage FCM tokens sample #958

wants to merge 2 commits into from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants