I'm trying to sign up a new user with email and password using Firebase.
Below you can see my Vue method.
signup() {
if (!this.validate()) return
const auth = getAuth()
createUserWithEmailAndPassword(auth, this.email, this.password)
.then(() => {
console.log("Signup successful!")
})
.catch((error) => {
const errorMessage = error.message
console.error("Signup error! ", errorMessage)
})
}
Right below my script tag I have this import:
import { getAuth, createUserWithEmailAndPassword } from "@/firebase.js"
And in my firebase.js file I have this code:
import { initializeApp } from "firebase/app"
import { getAuth, createUserWithEmailAndPassword } from "firebase/auth"
const firebaseConfig = {
// here I pasted the config object I got from Firebase
}
initializeApp(firebaseConfig)
export { getAuth, createUserWithEmailAndPassword }
When I try to sign a new user up, I get this printed out in the console:
POST https://identitytoolkit.googleapis.com/v1/accounts:lookup?key=AIzaSyDmpWucdj9MuwM5mvjA5_TKMCFlsUXUGpg 400
Signup successful!
I can see that I have a new user registered in my Firebase console. Why is this error showing up then?