FCM Token is invalidating for chrome frequently, But it's working for firefox.
I have implemented onTokenRefresh()
callback.
Here is my implementation
messaging.onTokenRefresh(function () {
console.log("refresh token called(webpush)");
messaging.getToken().then(function (refreshedToken) {
console.log('Token refreshed.', refreshedToken);
// post data to db
});
});
How to check that above implementation is working properly. Not able to save the refreshed token to our DB.
At the moment the on token refresh callback is not used. But it will be in a future update.
If you wanted to check your logic you could just pull out the callback and call i directly
To test you'd just call
onRefreshCb()
to test out your logic, using deleteToken if you wanted to ensure you would get a new token.