Firebase Cloud Messaging (WebPush) token expiration handling

∥☆過路亽.° 提交于 2019-12-13 01:09:51

问题


As I found out in Firebase source, every token has an expiration time of one week. And because messaging().onTokenRefresh is not implemented now, I'm assuming that there is no way of sending webpush-notifications to users that haven't been on my website with configured FCM for a week or longer.

Or my assumption is incorrect and this expiration exists only on browser side? And tokens on the server-side of FCM aren't expiring without a call from browser to recreate token?


回答1:


It's not an actual expiration, but just a way to update the token information on Firebase servers. If the token is still valid (and it most likely is), updateToken method will return the same token, and it will keep working.

If you get a different token after a getToken call, you can safely overwrite the previous token in your server.



来源:https://stackoverflow.com/questions/50079039/firebase-cloud-messaging-webpush-token-expiration-handling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!