Firebase auth/user-token-expired: Where is it the error being thrown? (JS)

Viewed 251

Background:
We are manually revoking our firebase refresh tokens via the firebase admin SDK in our backend. In our angular app we are using using the onAuthStateChanged method of firebase.auth() to determine whether a user authenticated. With the result of the onAuthStateChanged we use the method .getIdTokenResult() in order to get some metadata about the user and store it locally.

The problem:
After revoking the refresh token of a user from our backend, we wait for the ID token of the client to expire (an hour). Near the expiration time we notice an uncaught error being thrown in the client console log. We understand it's normal, as we just revoked the refresh token, and it was due to to refresh. The problem is we are unable to figure out where to catch this exception and where it is being thrown. We have placed .catches() , try/catches and provided error callbacks around all the suspected calls (onAuthStateChanged, getIdTokenResult), but we still seem to get the exception.

Is there an internal process that automatically attempts to refresh tokens? If so, how do we go about catching this error?

We think it's internal because the stack trace is pretty tough to follow and leads us nowhere productive.

The error details:

code: auth/user-token-expired
message: The user's credential is no longer valid. The user must sign in again.

And here is the nonsensical stack trace here is the nonsensical stack trace

0 Answers
Related