简体   繁体   English

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

[英]POST 400 error on signup - Vue JS / Firebase

I'm trying to do a signup on my app but I'm getting error like:我正在尝试在我的应用程序上进行注册,但出现如下错误:

"POST https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=AIzaSyCO3QWLiPMJyrZqZLi66vsRsvVVgcGvyQg 400" 发布 https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=AIzaSyCO3QWLiPMJyrZqZLi66vsRsvVVgcGvyQg 400”

I'm using Vue JS and Firebase 9. My code in Signup.vue is:我正在使用 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;
          
        });
    },
  },
}; 

The issue is that you are using a weak password.问题是您使用的是弱密码。 Try confirming this by going to the Network section in the developer tools and click the error name尝试通过转到开发人员工具中的“网络”部分来确认这一点,然后单击错误名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM