This repository demonstrates a basic example of a problem I have identified with the firebase SDK. The issue is tracked at firebase/firebase-js-sdk#6174
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 certain network call initiated by the firebase SDK upon page refresh errors out with a 400 TOKEN_EXPIRED error message.
- Update firebase.js with your project's firebase credentials
- Run the application using yarn start
- Open the browser console and click on Sign Up and observe both the console and the network tab.
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.