firebase / firebase/firebase-js-sdk
FR: Change behavior of onAuthStateChanged.
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### [REQUIRED] Describe your environment
* Operating System version: windows 10
* Browser version: Google Chrome 88
* Firebase SDK version: 8.1.1
* Firebase Product: auth
Problem:
If a user was logged and try to open spa app on page wich required auth access the app should waiting until auth will be confirmed and only then call callback `onAuthStateChanged` with the user object. This check can be quite long (more than 5 seconds with slow 3g).
Propose:
Call callback when we find user information in storage with this user object without waiting for the end of the auth check. If auth check return that user was logout than call callback with user null.
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.