How Can I Check user exists in Firebase auth in Signup Button via react native?
This is my Login Page Code:
export de
It is very simple. Add a then() and catch() to your firebase method in signUp function.
firebase.auth().createUserWithEmailAndPassword(this.state.email, this.state.password)
.then(()=>{
console.log('Signup successful.');
this.setState({
response: 'Account Created!'
})
})
.catch((error)=> {
console.log(error.code);
console.log(error.message);
});
Information on different Error Codes:
auth/email-already-in-use
Thrown if there already exists an account with the given email address.
auth/invalid-email
Thrown if the email address is not valid.
auth/operation-not-allowed
Thrown if email/password accounts are not enabled. Enable email/password accounts in the Firebase Console, under the Auth tab.
auth/weak-password
Thrown if the password is not strong enough.