I’m fairly new to Vue (and not too experienced a dev tbh either) and been following this tutorial to create authentication for my app, but since the firebase code used in it is not Firebase v9, it does not work at all for me.
I figured I try to work around figuring it all out and just used the compat libraries, and somewhat updated the code. Now I keep getting mentioned error, and obviously no user creation happens in firebase either.
<h1>Create an Account</h1>
<p><input type="text" placeholder="Email" v-model="email" /></p>
<p><input type="password" placeholder="Password" v-model="password" /></p>
<p><button @click="register">Submit</button></p>
</template>
<script setup>
import firebase from 'firebase/compat/app'
import { getAuth, createUserWithEmailAndPassword } from "firebase/auth";
import { useRouter } from 'vue-router' // import router
const email = ''
const password = ''
const router = useRouter() // get a reference to our vue router
const register = () => {
const auth = getAuth()
return createUserWithEmailAndPassword(auth, email,password)
.then((userCredential) => {
console.log('Successfully registered!');
router.push('/feed') // redirect to the feed
})
.catch(error => {
console.log(error.code)
alert(error.message);
});
}
</script>
This is my register page which returns the error… I feel dumb for not getting it, can anybody help a noob dev with his basic problems?