Home > Enterprise >  vue firebase auth output console.log of auth/internal-error instead auth/invalid-password
vue firebase auth output console.log of auth/internal-error instead auth/invalid-password

Time:03-28

I'm trying to test authentication of my simple vue application that using firebase, but the console.log of its error give output "auth/internal-error" instead "auth/invalid-password" when I give empty password

Firebase: An internal AuthError has occurred. (auth/internal-error).

<script setup>

import { ref } from 'vue'
import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import { useRouter } from 'vue-router'

const email = ref('')
const password = ref('')
const errMsg = ref()
const router = useRouter()
const login = () => {
    firebase
        .auth()
        .signInWithEmailAndPassword(email.value, password.value)
        .then((data) => {
        console.log('Successfully logged in!');
        router.push('/dashboard')
        })
        .catch((error) => {
            const errorCode = error.code;
            const errorMessage = error.message;   
            console.log(error.message);
        })
}

CodePudding user response:

You should not allow the request with an empty password. Handle the error before, when you know it will happen.

  • Related