-
Notifications
You must be signed in to change notification settings - Fork 1.6k
FCM Tokens do not refresh 'deleteToken' -> 'getToken' is called #6433
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
To first understand your use case, won't the function fail if you pass in nil as authorizedEntity? Can you share your sample code of calling the public API? |
Sorry, I was a bit in a hurry when writing the issue.
You're right about that. I got a little confused as we call our library without any parameters, but the Our project is created in React Native, and we use React Native Firebase as a bridge to the Firebase SDK. I added all the related code with links to the original files in the OP, hopefully this clears up our use case a bit. I'll try to get a React Native example project with the above bug reproducible. |
@mtieltjes, @chliangGoogle We have a similar issue, and if you check you can see that in the cache there is a key senderid.*, and when the RNF try to delete the token by the firebase-ios-sdk then the default scope is "FCM", so it try to find the senderid.FCM key. If you use this code in javascript, then it can be quick workaround for you (I tested it and we got a new token): So I am not sure that the bug is inside the firebase-ios-sdk. On the other hand I am not sure that what happens when the FCM invalidating a token, dose that event triggering with the right scope? Or the firebase-ios-sdk has the bug that not save the token inside the cache with senderid.FCM? |
@golya We do save the token per sender ID per scope, and when you invalidate the token by calling deleteToken, we will clear the cache and send a request to our server to invalidate it too. |
@chliangGoogle Thanks for your answer, based on my debug it seems the scope is always a constant and a hardcoded string during the save and when you try to find it in the cache by the instance handler: Probably I do not see the whole picture and operations, but it seems using the instance handler you can not really control the scope. Where can I find that code part where you save the token per senderID per scope? |
@golya That's for storing the default token which is the most common case. |
@chliangGoogle Got it, thank you for the quick response! :) In this case my question if someone would like to use the instanceIDWithHandler for getting back the token then it is impossible to use the scope, am I right? |
@chliangGoogle can you confirm please that the sdk can handle scope related tokens in the cache? :) |
Yes, as explained in thread above. And if someone use instanceIDWithHandler, then no, because it's using the default scope. |
@chliangGoogle thanks!! In this case I am not sure that this issue is make sense at all. I suppose that we can close it. |
Step 1: Describe your environment
CocoaPods
(through React Native Firebase)Step 2: Describe the problem
When deleting the FCM token, and getting a new one, the same (cached & invalid) token is returned.
By stepping through breakpoints I found the lines that cause this behavior; see relevant code
Steps to reproduce:
In our ReactNative project, we use React Native Firebase as bridge to the Firebase SDK.
I copied the relevant code of that library, of which our usage boils down to this:
Objective-C code
Link to original code
Which is then being called from the React Native part of the library
Link to original code
All we do with that library is call
getToken()
anddeleteToken()
without parameters, using the defaults as declared above.The result of this is:
Relevant Code:
This line does not get called, where I would expect it to. The surrounding if results in
false
firebase-ios-sdk/Firebase/InstanceID/FIRInstanceIDTokenManager.m
Line 149 in dbe9007
Then, when getting the new token, the cached version is returned here:
firebase-ios-sdk/Firebase/InstanceID/FIRInstanceID.m
Line 190 in fa04212
The text was updated successfully, but these errors were encountered: