In my app, I'm authenticating users with Google sign in. How to check if the user is signing in for the first time?
Asked
Active
Viewed 1,099 times
0
-
Maybe this helps https://stackoverflow.com/questions/39550149/check-if-user-is-authenticated-for-the-first-time-in-firebase-google-authenticat – Constantin Beer Aug 25 '19 at 12:14
1 Answers
4
If the user is signing in for the first time, the AdditionalUserInfo.isNewUser
property will be true.
Note that this property can be a bit finicky in my experience as "first" is a bit too strict. If that is the case for you, you might want to instead compare the creationTime
and lastSigninTime
in the FirebaseUserMetaData
object explicitly to determine whether the user is "new enough".

Frank van Puffelen
- 565,676
- 79
- 828
- 807
-
1Thanks! Solved it by comparing creationTimestamp and lastSignInTimestamp. But in my project, unable to access some classes like AdditionalUserInfo, AuthResult etc. Can you please explain it? – Newaj Aug 26 '19 at 04:07