Elbphilharmonie
Elbphilharmonie

Reputation: 75

Oops. The email address is badly formatted Firebase / Vue

I'm getting the error "Oops. The email address is badly formatted." also when I don't even fill anything in.

I've already tried importing Firebase on a different spot, but it didn't fix the issue.

<script>
import firebase from "firebase";

export default {
  name: "login",
  data() {
    return {
      email: "",
      password: ""
    };
  },
  methods: {
    login: function() {
      firebase
        .auth()
        .signInWithEmailAndPassword(this.email, this.password)
        .then(
          function(user = user) {
            alert("Well done! You are now logged in");
          },
          function(err) {
            alert("Oops. " + err.message);
          }
        );
    }
  }
};
</script>

Upvotes: 0

Views: 438

Answers (2)

Elbphilharmonie
Elbphilharmonie

Reputation: 75

Fixed it with the following code:

    <script>
  import firebase from 'firebase';
  export default {
    name: 'login',
    data() {
      return {
        email: '',
        password: ''
      }
    },
    methods: {
      login: function() {
        firebase.auth().signInWithEmailAndPassword(this.email, this.password).then(
          (user) => {
            this.$router.replace('home')
          },
          (err) => {
            alert('Oops. ' + err.message)
          }
        );
      }
    }
  }
</script>

Upvotes: 0

SalunkeAkash
SalunkeAkash

Reputation: 256

hey you can if the email id is with qoutes or not

you can check that in inspect network

Upvotes: 1

Related Questions