[Vuejs]-Firebase: The email address is already in use by another account. (auth/email-already-in-use)

3👍

Capture your error with error code :

if(errorCode == "auth/email-already-in-use"){
    alert("Email already in use")
}
👤Ashish

3👍

firebase.auth().createUserWithEmailAndPassword(email, password)
  .then((userCredential) => {
    // Signed in 
    var user = userCredential.user;
    // ...
  })
  .catch((error) => {
    if (error.code == "auth/email-already-in-use") {
        alert("The email address is already in use");
    } else if (error.code == "auth/invalid-email") {
        alert("The email address is not valid.");
    } else if (error.code == "auth/operation-not-allowed") {
        alert("Operation not allowed.");
    } else if (error.code == "auth/weak-password") {
        alert("The password is too weak.");
    }
  });
👤John

0👍

you can just split your error message because the actual message is after the first space character.

error.substring(error.indexOf(' ') + 1);

Leave a comment