firebase / firebase-android-sdk

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

Firebase AUTHENTICATION_FAILED on some devices #1286

Closed jehadmashhour closed 2 years ago

jehadmashhour commented 4 years ago

I use the Firebase remote config SDK , i have noted that on some devices (nearly 15 users) that the Firebase SDKs not working .

The error message is : Failed to get Firebase Instance ID token for fetch

The log shows the following error :

com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException: Failed to get Firebase Instance ID token for fetch. at c.i.c.r.a.m.a(com.google.firebase:firebase-config@@19.1.1:30) at c.i.c.r.a.j.then(Unknown Source:4) at com.google.android.gms.tasks.zzf.run(Unknown Source:3) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:784) Caused by: java.io.IOException: AUTHENTICATION_FAILED at c.i.c.m.P.then(com.google.firebase:firebase-iid@@20.0.2:7) at com.google.android.gms.tasks.zzd.run(Unknown Source:7) ... 3 more

Notes :

Some of devices have the same issue -> Huawei DUB-LX1 , HUAWEI JKM-LX1 , Samsung SM-A750F , Samsung SM-J700H

Let me know if you need my google api key .

i-am-darshil commented 2 years ago

I have been receiving Firebase AUTHENTICATION_FAILED. Below was my analysis.

Failed sessions -> AUTHENTICATION_FAILED received Success Sessions ->FCM token recieved

"text": "{\n  \"name\": \"projects/<Project ID>/installations/<fid>\",
  \"fid\": \"<fid>\",
  \"refreshToken\": \"2_8hvwdXJl1frsO2-QMamcJVuBN47Wr4tbja9i1LdBo3UH3TgfpW00f0xZXxpISLhe\",
  \"authToken\": 
        {\"token\": \"<authToken>\",
        \"expiresIn\": \"604800s\"\n  }\n}\n"
},
"text": "token=fcXcK_OaSV22oclS8g_IVV:APA91bE35IjoWQyAlRS0ON6aj6_vxY5qlktdRCrnog_8tZ_2joHn1mLlkhSdsjenK50ESgNNhSPIUVzqrLGU6tBD_Y2azu1rKCypzqOpmD7u6hlYkjt8lH28_WHbOufJs9d7BulG-Wwf"

Now, what’s interesting is Google shut down C2DM long back in 2015. Also, if you visit the API link, the following is found, wherein it mentions server and client APIs were removed on May 29, 2019, and currently any calls to those APIs can be expected to fail

 IID tokens are used in providing the app instance's token  https://iid.googleapis.com/iid/info/IID_TOKEN

Folks, any idea why calls to https://android.clients.google.com/c2dm/register3 are made?

namgk commented 2 years ago

Same here, it seems if firebase installation is present, i.e.

implementation 'com.google.firebase:firebase-installations:17.0.0'

Firebase Remote Config will depend on this guy. On some devices, such as FireTV as we tested, Firebase Installations wasn't able to make the API call (403). Eventually Firebase Remote Config wasn't working at all.

Our fix was just to remove that firebase-installations dependency, which was somehow there for no reason.

I think if Firebase Installations is not working, it should fallback where as if Firebase Installations doesn't exist.

gsakakihara commented 2 years ago

Closing this as the original issue appears to have been solved. It's unclear whether the other reports added to this issue have the same root cause or are unrelated. For issues that are not related, a new issue should be opened, using the issue template with all of the information added.

For the questions on AUTHENTICATION_FAILED, this 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.

Also note that FirebaseInstanceId requires Google Play services to create a token and it will fail on devices without it.