firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.26k stars 572 forks source link

firebase get token authentication failed for new users #6058

Closed gkkzz closed 2 months ago

gkkzz commented 3 months ago

firebase-annotations-16.2.0 firebase-messaging-23.2.0 firebase-common-20.3.1

[REQUIRED] Step 3: Describe the problem

not emulator

After registering FCM,FirebaseMessagingService onNewToken no call back ,so I tried to go to get fcm token , but hint

Fetch FCM token failed: java.io.IOException: java.util.concurrent.ExecutionException: java .io.IOException: AUTHENTICATION_FAILED

not a recurrent problem,We see that this issue happens only for new users, who is registering for the first time.

gkkzz commented 3 months ago

It can be solved after restarting this device , but it is not a good solution

So I want to know the reason

lehcar09 commented 3 months ago

Hi @gkkzz, thank you for reaching out. Just wanted to clarify, you mentioned that, “After registering FCM, FirebaseMessagingService onNewToken no call back”, does this mean the user's existing token gets invalidated and is expecting a new registration token, but the onNewToken is not triggered?

The IOException: AUTHENTICATION_FAILED error message, usually means that the device does not have a valid registration (Android ID). Factory resetting the device causes the Android ID to be reset and it will try to register the new ID, so this may be why that fixed it in those cases.

gkkzz commented 3 months ago

@lehcar09 Thank you for your reply

“After registering FCM, FirebaseMessagingService onNewToken no call back” I mean When I first registered, I understood that onNewTokenwould also have a callback and would tell me which token was successfully registered,I take this token to the Server,But it didn't tell me .

IOException: AUTHENTICATION_FAILED After this happened, we didn't do a factory reset, we just restarted the device and it was restored. So restart device also reset android ID? If this happens, retrying multiple times won't seem to work.

Has this bug always existed? Is there any good fix or planned repair time?

thanks

lehcar09 commented 2 months ago

Thanks for the clarification @gkkzz. I tried reproducing the issue, however, I wasn't able to encounter the issue. The onNewToken was triggered accordingly. Could you share an MCVE to help us investigate the issue?

As for the IOException: AUTHENTICATION_FAILED, there was a similar issue https://github.com/firebase/firebase-android-sdk/issues/1286 reported before. Can you share the FirebaseInstallation version you're using?

Aside from that, Aside from that, are you constantly experiencing this error? Could you provide the steps to reproduce the issue? or does the issue occur on certain devices and/or android versions?

google-oss-bot commented 2 months ago

Hey @gkkzz. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 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!

google-oss-bot commented 2 months ago

Since there haven't been any recent updates here, I am going to close this issue.

@gkkzz if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.