novu icon indicating copy to clipboard operation
novu copied to clipboard

🚀 Feature: Expiration Time for FCM Tokens

Open NarHakobyan opened this issue 2 years ago • 6 comments

🔖 Feature description

Following to Firebase docs, They recommend us to store tokens with expiration time and remove token if it staled. Also it would be nice to have option to remove token from user if it's being connected to another.

🎤 Why is this feature needed ?

  • Avoid forcing user to have a cron job and update all users tokens (it will be huge load for Novu).
  • Novu's database would be clean of salted and outdated tokens
  • Avout filtering users and remove token from them.

✌️ How do you aim to achieve this?

I want this feature to follow firebase best practice, avoid creation of cron job which will update all users tokens in novu, and removing token when user logged out from app.

🔄️ Additional Information

No response

👀 Have you spent some time to check if this feature request has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

No response

NarHakobyan avatar Sep 27 '22 11:09 NarHakobyan

Sounds good would like to work on it if it has been approved !

KlausMikhaelson avatar Sep 28 '22 14:09 KlausMikhaelson

@KlausMikhaelson assigned you 🙏

scopsy avatar Oct 01 '22 20:10 scopsy

Thank you @scopsy will start working on it !

KlausMikhaelson avatar Oct 04 '22 15:10 KlausMikhaelson

Hey @scopsy quick update: I was travelling a lot from the past 2 weeks so forgot to work on it but I am at home now and have started the work !

KlausMikhaelson avatar Oct 12 '22 16:10 KlausMikhaelson

Hey @KlausMikhaelson! How is it going so far? Any updates?

iampearceman avatar Dec 01 '22 01:12 iampearceman

Hi! We're considering adding Novu to our company right now and this feature would be really helpful. How would you picture this working @scopsy? Through a MongoDB TTL index or a cron job that deletes stale tokens? I could help with this if needed :)

tomcastro avatar Jan 12 '23 11:01 tomcastro

@tomcastro mongodb ttl might one way, the problem is that we will need to extract the whole credentials to another collection for it. And I'm afraid that managing this on the database level will have a lot of limitations. So perhaps doing this as part of the application layer might even work better and will be more customizable in that sense.

scopsy avatar Jan 30 '23 11:01 scopsy

Hi @scopsy Why can't we use a silent notification firebase API to send a notification to the user via cron? If we can't send a notification to that user, we may just remove that token from the database.

SRICHARANSIRPA avatar Jul 23 '23 19:07 SRICHARANSIRPA

@SRICHARANSIRPA that's a good point, we can also try to extract the mapped stale token errors with it. And then remove when an exception of such type happened

scopsy avatar Sep 10 '23 15:09 scopsy

@scopsy if my above suggestion is approved, am happy to work on it

SRICHARANSIRPA avatar Nov 08 '23 16:11 SRICHARANSIRPA

@SRICHARANSIRPA how do you plan on choosing to which token to try sending silent notification? in other words, when the cron triggers based on what criteria do you pick the token to send the notification to?

mahendraHegde avatar Nov 12 '23 20:11 mahendraHegde