-
Notifications
You must be signed in to change notification settings - Fork 976
Description
Describe your environment
- Operating System version: macOS Big Sur Version 11.4
- Browser version: Google Chrome Version 100.0.4896.127 (Official Build) (arm64)
- Firebase SDK version: 9.6.11
- Firebase Product: auth
Describe the problem
When a new user (email is not yet registered with firebase authentication) signs in using Google Login, and the app
is refreshed immediately after (approx 10 seconds), the authenticated state is lost. On closer inspection, it was identified that a network call initiated by the firebase SDK upon page refresh (https://identitytoolkit.googleapis.com/v1/accounts:lookup?key=) errors out with a 400 TOKEN_EXPIRED error message.
{
"error": {
"code": 400,
"message": "TOKEN_EXPIRED",
"errors": [
{
"message": "TOKEN_EXPIRED",
"domain": "global",
"reason": "invalid"
}
]
}
}
Steps to reproduce:
A basic working example of this can be found at https://github.com/priyath/firebase-auth-issue
- Checkout the above repository
- Update firebase.js file with your project's firebase credentials
- Run the application using yarn start
- Open the browser console and click on Sign Up. Sign Up using credentials of an account that is not yet registered with your firebase project.
- Observe both the console and the network tab.
Observations:
Upon successful login (and register) The auth state changed log will fire with the User object.
After 10 seconds, a page refresh will be triggered, after which the auth state changed log will be null.
If you inspect the network tab, the request to https://identitytoolkit.googleapis.com/v1/accounts:lookup?key= will show a 400 TOKEN_EXPIRED error.