question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authentication failed refresh Token

See original GitHub issue

I’m using Firebase Authentication 9.0.2 (Facebook, Google, email/password or anonymous) in my Android app, this part works correctly.

mAuthListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user = firebaseAuth.getCurrentUser();
            if (user != null && !flagAuth) {
                // User is signed in
            } else if (user == null) {
                // User is signed out
            }
        }
    };

After this, I’m listening on database.getReference(".info/connected") and database.getReference(".info/authenticated"), first time I’m connecting these 2 values are true for all authenticated providers. When I’m restarted my application, it is always true.

final DatabaseReference refAuthenticated = database.getReference(".info/authenticated");
    refAuthenticated.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            boolean connected = dataSnapshot.getValue(Boolean.class);
            if (connected) {
                AppLog.d("Authenticated");
                });
            } else {
                AppLog.d("No more Authenticated");
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
            AppLog.d("Listener was cancelled at .info/authenticated");
        }
    });

But after 1 hour (when my token is expired), Firebase SDK has to refresh the token automatically but it failed with this error

pc_0 - Authentication failed: expired_token (Auth token is expired)

Or this one

pc_0 - Authentication failed: invalid_token (Invalid claim 'kid' in auth header.)

I have checked my SHA-1 key in my Firebase project and it is correct.

Anybody can help me? Thank you.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
Robbypatel1357commented, Aug 17, 2017

@i have already same problem of that issue after some hour firebase not write on server but write in internal data

0reactions
4bottigliecommented, Nov 14, 2017

Same here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error authenticating with the refresh token due to: expired ...
Error authenticating with the refresh token due to: expired access/refresh token when I try to retrieve/deploy source from org.
Read more >
Understanding Refresh Tokens - Auth0
When access tokens expire or become invalid but the application still needs to access a protected resource, the application faces the problem of...
Read more >
Error authenticating the refresh token due to - Greytrix
Work around for VS Code Issue: Error authenticating the refresh token due to: expired access/refresh token. You would not find any solution ...
Read more >
How do I fix the error "Refresh token missing"?
This error may occur if you have your inbox setup and connected with Google Apps. ... In some rare cases, you may run...
Read more >
Azure AD refresh token is getting invalid frequently
This error is due to when refresh token can be expired due to either if the password changed for the user or the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found