注册时出现POST 400错误- Vue JS / Firebase

icomxhvb  于 2022-12-14  发布在  Vue.js
关注(0)|答案(1)|浏览(119)

我尝试在我的应用程序上进行注册,但遇到如下错误:
“开机自检https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=AIzaSyCO3QWLiPMJyrZqZLi66vsRsvVVgcGvyQg 400”
我正在使用Vue JS和Firebase 9。我在Signup.vue中的代码是:

import { initializeApp, db } from "@/firebase.js";
import { getAuth, createUserWithEmailAndPassword } from "firebase/auth";
import { doc, setDoc } from "firebase/firestore";

const auth = getAuth();

export default {
  name: "signup",
  data() {
    return {
      firstName: "",
      lastName: "",
      username: "",
      password: "",
      country: "",
      city: "",
      zipCode: "",
    };
  },
  methods: {
    
    signupClick() {
      createUserWithEmailAndPassword(auth, this.username, this.password)
        .then((userCredential) => {
          // Signed in
          const userProfileData = {
            username: this.username,
            firstName: this.firstName,
            lastName: this.lastName,
            country: this.country,
            city: this.city,
            zipcode: this.zipCode,
          };

          this.$router.push({ name: "dashboard" });
          console.log("Uspjesna reg");
          const user = userCredential.user;

          
          const userProfile = setDoc(doc(db, "users", userCredential.user.uid), userProfileData);
        })
        .catch((error) => {
          const errorCode = error.code;
          const errorMessage = error.message;
          
        });
    },
  },
};
piztneat

piztneat1#

问题是您使用的是弱密码。请转到开发人员工具中的“网络”部分并单击错误名称,尝试确认此问题

相关问题