FR: please add function Auth.getCurrentUser() as a promise that will return current user or null
Problem
Firebase SDK version: 4.9.0 Firebase Product: auth `Auth.currentUser` object is unreliable to get user from persistence storage. If the authentication system could be pending and don't really have ensure finishing endpoint then you should have a promise for it So I want to have promise function `Auth.getCurrentUser()` in addition to `onAuthStateChange` that would eventually return user but would return null if no user exist in persistence storage or user require sign in from expired token
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: FR: please add function Auth.getCurrentUser() as a promise that will return current user or null
You can easily implement that on your own with a couple of lines: [code block]
Trust Score
8 verifications
- 1
You can easily implement that on your own with a couple of lines:
[code block]
Validation
Resolved in firebase/firebase-js-sdk GitHub issue #462. Community reactions: 50 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep