expose additionalUserInfo to firebase user #3804
Unanswered
GaneshvrBhat
asked this question in
Feature request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Issue: Unable to check if the user is a new user or existing user, unless the user reauthenticates after signup.
let's assume we have a Splash screen with
FirebaseAuth.instance.authStateChanges().listen((user) {}
Slash screen will route to Login Screen or home Page depending on auth state.
When the user successfully signs in, the listener at the splash screen will get noticed and will route to the home page.
This leaves
UserCredential additionalUserInfo
obtained during sign in the not usable state unless you save it in local preference or something.exposing additionalUserInfo to user object helps us to check if the user is new or old and act accordingly.
The other alternative is checking
user.metadata.creationTime == user.metadata.lastSignInTime;
but this always will be true until user signs out after signup or first login.Please correct me if I'm wrong
Beta Was this translation helpful? Give feedback.
All reactions