firebase get token authentication failed first run
See original GitHub issue[REQUIRED] Step 2: Describe your environment
-
Android Studio version: Android Studio Arctic Fox | 2020.3.1 Patch 2 Build #AI-203.7717.56.2031.7678000, built on August 27, 2021
implementation platform(‘com.google.firebase:firebase-bom:28.4.2’) implementation ‘com.google.firebase:firebase-messaging’ implementation ‘com.google.firebase:firebase-analytics’
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
I can only replicate this in every fresh install app by wiping the data and then run app. works fine when uninstalling then run app and subsequent runs.
throws Topic sync or token retrieval failed on hard failure exceptions: AUTHENTICATION_FAILED. Won’t retry the operation.
Relevant Code:
public class StobyFirebaseMessagingService extends FirebaseMessagingService
{ ... }
// MainActivity - getting the token
FirebaseMessaging.getInstance().getToken()
.addOnCompleteListener(new OnCompleteListener<String>() {
@Override
public void onComplete(@NonNull Task<String> task) {
....
}
});
// for workaround - I invoke the above token snippet twice in different Fragment
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Firebase Token Authentication error - Stack Overflow
I think you didn't sign before uploading files. In onCreate() of launcher activity, try this code FirebaseAuth mAuth = FirebaseAuth.
Read more >Manage User Sessions | Firebase Authentication - Google
Every time a user signs in, the user credentials are sent to the Firebase Authentication backend and exchanged for a Firebase ID token...
Read more >getToken succeeds or fails randomly · Issue #5081 - GitHub
getToken seems to randomly fail without plausible explanation. I run it with the exact same config on the same device multiple times in...
Read more >invalid_token (Invalid claim 'aud' in auth token.) - Google Groups
This error basically means the SDK failed to authenticate to the Firebase Database because the auth token was for a different project. There...
Read more >Firebase auth: Error getting access token from GOOGLE_OIDC
For me, Web client secret was wrong. Above, next to "Web SDK configuration", mouse over info icon, click the link for "Google API...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It should happen soon after the device has network connectivity. The emulator is an unusual case because it just starts immediately on first start/after a data wipe. Real devices go through the setup process, which usually allows enough time for the device to register before the user has a chance to do anything else or install apps, so it’s rare for an app to encounter this. Note that it’s possible that a device fails to register for some reason, so your app should always be able to handle the AUTHENTICATION_FAILED case gracefully, but in general you shouldn’t expect this to be a common case.
Seems working as you said(need around 2-3mins), In what lifecycle the device will finish setting up/registering/uploading info? I want to hook up after registering and get token.