Skip to content

Expose isNewUser information in IDPResponse #1242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
samtstern opened this issue Apr 4, 2018 · 8 comments
Closed

Expose isNewUser information in IDPResponse #1242

samtstern opened this issue Apr 4, 2018 · 8 comments

Comments

@samtstern
Copy link
Contributor

See:
#1209 (comment)

Currently we tell developers to rely on the created / signed in timestamps when checking to see if a FirebaseUser is new or not. However these timestamps have some limitations that make them occasionally unreliable.

If we could expose this information in the response we provide at the end of the AuthUI flow, that would help developers launch follow-up flows.

@curiousily
Copy link

Is there any reliable way to workaround this using the current version of the library?

@samtstern
Copy link
Contributor Author

@curiousily the timestamps are reliable with the edge case issue that if a new user signs up, signs out, and signs in within two minutes they will still look "new" because the timestamps wont change.

@j2emanue
Copy link

you guys can also send a flag in onActivityResult intent. like a boolean to represent if its new or existing.

@j2emanue
Copy link

j2emanue commented May 10, 2018

@samtstern, its me again. so i noticed one strange thing. my business has both website and app but use same firebase authentication table. so i signed up for a new account on our website as an email provider. checked firebase console and saw the account there as email provider. waited almost 2 hours..... then logged into app with email provider, but to my surprise i found it as a new signup. so i checked and the following was true, why ?

metadata.creationTimestamp == metadata.lastSignInTimestamp

after waiting almost 2 hours should this not be false. is this check only local to the mobile application ?

@curiousily
Copy link

curiousily commented May 17, 2018

Hey @samtstern,

Any progress on this issue? This really degrades the experience for our users, I can't tell them to not sign up again within the next 2 minutes (if that is really the limit).

@samtstern
Copy link
Contributor Author

This has been released in version 4.1.0

@AndrazP
Copy link

AndrazP commented Apr 30, 2020

Hi @samtstern
I found this old issue after noticing that comparing timestamps
metadata.getCreationTimestamp() == metadata.getLastSignInTimestamp()
is not reliable. isNewUser seems to fix it.
Are there any drawbacks of using this method? Why is comparing timestamps still recommended in README?

@samtstern
Copy link
Contributor Author

@AndrazP I think I just forgot to update the README! isNewUser is preferred. Want to send a PR and fix the README?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants