notif user if email already exist in firebase auth.

395 views
Skip to first unread message

ade guntoro

unread,
Aug 7, 2017, 10:59:22 AM8/7/17
to Firebase Google Group
Hai, i just create simple login and sign up page using Firebase auth using email and password method. But why my user dont get notif if email already exist when they try register with same email ?
i use this code from Firecast to display error, but no error coming up if i sign up with same email.
            btnreg.addEventListener('click', e => {
                const email = txtemail.value;
                const pass  = txtpass.value;
                const auth  = firebase.auth();
                //const promise = auth.createUserWithEmailAndPassword(email, pass);
                const promise = auth.createUserWithEmailAndPassword(email, pass);
                promise.catch(e => console.log(e.message));
            });

thanks for your help

Bassam

unread,
Aug 7, 2017, 5:10:50 PM8/7/17
to Firebase Google Group
Hey Ade,
You can use `auth.fetchProvidersForEmail` to lookup if an email exists or not before calling `auth.createUserWithEmailAndPassword` or `auth.signInWithEmailAndPassword`.

Best regards,
Bassam
Reply all
Reply to author
Forward
0 new messages