AngeloC
AngeloC

Reputation: 3523

How to determine if a user is newly created or an existing user in Firebase auth?

Following listener is used to detect if a user is logged in,

firebase.auth().onAuthStateChanged(function(user){})

is there a way to determine if the user is created with

createUserWithEmailAndPassword()

or due to a login with:

signInWithEmailAndPassword()

Thanks,

Upvotes: 0

Views: 62

Answers (1)

camden_kid
camden_kid

Reputation: 12813

After createUserWithEmailAndPassword()

user.emailVerified is false

After signInWithEmailAndPassword() (assuming the user has verfied their email)

user.emailVerified is true

Upvotes: 1

Related Questions