-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fcmToken not revoked after calling deleteIDWithHandler #4416
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
Comments
Hi @wangjiejacques, thanks for reporting. May I know if you're sending notifications via user segment, topic or token? |
Hi, @rizafran via token. |
+1, I am experiencing this same issue. I tried reverting to an older SDK version (5.7.0) but the issue still occurs there. Interestingly, I can see from the app logs in Xcode that after calling
Response
If I wait long enough then eventually, I do start getting "NotRegistered" responses:
The window of time seems to vary randomly, I've seen it take up to an hour to recognize the token was deleted. In the meantime, it keeps showing push notifications on my device even though the message was sent with the deleted token. |
As far as I know, the call to InstanceID.instanceID().deleteID triggers a Firebase-wide deletion flow of data associated with the given Instance/Instance-ID. This flow deletes all data that is stored by Firebase applications associated with the app-install identified by that Instance-ID, including FCM tokens, notifications, remote configurations, predictions, A/B tests, targeting-audiences, and so on. |
OK good to know. I'm using a hybrid app plugin (ionic). The equivalent android code:
FWIW I've not observed any delay whatsoever on Android, only iOS has been showing this delay behavior for token deletes recently. My understanding from @andirayo now is this is working as designed in the client SDK, and simply deleting an FCM token is not a reliable way to immediately shut off notifications for a device. The fix (for me) would be to implement a custom However, this still poses problems for the use case where a user logs out of my app while offline, then closes the app. I have no way of detecting the token was deleted from my backend, it will still send notifications to that device. @andirayo any advice for handling this scenario? |
@wangjiejacques @tommy-hartz This is expected as you didn't turn off auto init enabled flag. |
@chliangGoogle actually I have tried disabling the auto init, when doing so it does NOT automatically create a new token as expected. However when doing so, I still see the same behavior with the deleted token still "working" for some time, giving "success" responses from FCM push endpoint, and notifications displaying on device, even without a new instance id / token being registered by the device. Again, after some time I do get "NotRegistered" responses and no push delivered. The issue here is more so with the (unexpected) delay on deleting the instance ID and tokens I think. It doesn't seem to matter whether I leave auto init enabled or not. |
@wangjiejacques Can you also confirm this is expected behavior so we can move one issue off the list. |
Hi @chliangGoogle , I'm OK with the auto init, I think this is what I want. |
@wangjiejacques as @andirayo stated, there is a delay that old token still takes effect but should no more than 1 day. Is that the same experience you see? @andirayo I wonder why android has no such delay. |
@chliangGoogle Thanks, for the Android, since I only tested it once, I'm not sure if it is always the case. I will do the test to see if this is true for both Android and iOS. |
That would be very helpful. Thank you! |
I looked through the code-paths: The only thing that I could come up with is that maybe the actual requests from client-side look differently for Android IID-SDK and iOS IID-SDK which could explain a difference in available data server-side, which in turn could lead to the Android code path being able to immediately detect and invalidate all FCM-Tokens, while the iOS code path might be missing information to do that and has to wait for the next run of the Firebase / FCM deletion job. |
@chliangGoogle I confirm that |
@andirayo Looks like clients have different behaviors between android and iOS, is there something I can do to help you debug? |
Hey @wangjiejacques. We need more information to resolve this issue but there hasn't been an update in 7 days. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically. If you have more information that will help us get to the bottom of this, just add a comment! |
afaik this issue hasn't been resolved yet and shouldn't auto-close. |
Yes, but that implies the user will still be getting notified until they launch my app again. Or it would require background code execution with network communication, which Apple is usually restrictive about. I am not comfortable adding that to my app. Not sure it's possible, but the ideal solution for me would be an SDK update so that deleting tokens on iOS is immediately recognized by FCM the same way it does on Android. In the meantime, it's not a major issue for us. Most of our users are never logging out and deleting tokens anyway. |
Hey all, sorry for the slow update here--can you try deleting the FCM data through the new Messaging API instead of through InstanceID and seeing if the old FCM token is invalidated within a day? |
@morganchen12 I think this might need a backend change. |
Uh oh!
There was an error while loading. Please reload this page.
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
My app can still receive notification after calling
InstanceID.instanceID().deleteID
.Steps to reproduce:
InstanceID.instanceID().instanceID
.InstanceID.instanceID().deleteID
.expected behavior: the fcm token should be revoked, so the device should not receive notification.
actual behavior: the device can still receive notification.
What happened? How can we make the problem occur?
send notification after calling
InstanceID.instanceID().deleteID
Relevant Code:
The text was updated successfully, but these errors were encountered: