Vue + Firebase“已禁用指定的登录提供程序”[关闭]

问题描述 投票:0回答:1

我已经阅读了2年前关于这个问题的帖子,但找不到答案。我对网络很陌生,所以我读完了这个:https://savvyapps.com/blog/definitive-guide-building-web-app-vuejs-firebase让我的手弄湿了。一切都在本地服务器上完美运行,但我想将项目部署到firebase,以便我可以看到它是如何工作的。我做了一切,项目已部署,但当我尝试登录或注册时,我收到此错误:

“此Firebase项目已禁用指定的登录提供程序。在Firebase控制台中,在Auth部分的登录方法选项卡下启用它。”

电子邮件/密码提供程序已启用。我尝试禁用/启用它,等待一分钟,F5刷新页面,仍然相同。我搜索了firebase文档,查看了发行说明,在vue docs中搜索,在google中搜索,但找不到任何有用的方法来解决问题。我不知道为什么当它在本地服务器上工作时会出现此问题。

运行firebase init命令时,我使用了文件和公用文件夹的默认名称。 CLI功能我选择了Firestore和托管。

我重新安装了node,vue,vuex,firebase工具,使用“npm run build”重建项目,我能想到的一切,但我仍然得到错误。我将文件从“dist”文件夹粘贴到默认的公共文件夹,然后我保留了404文件。

这是firebase.json

{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

以下是package.json文件中的依赖项

"dependencies": {
    "firebase": "^5.4.1",
    "firebaseui": "^3.4.0",
    "moment": "^2.22.2",
    "vue": "^2.5.17",
    "vue-material": "^1.0.0-beta-10.2",
    "vue-router": "^3.0.1",
    "vuex": "^3.0.1"
  },

我添加了firebaseui,因为我认为它需要安装,即使我不会使用它。

如果我错过任何可能有用的信息,请告诉我!

firebase vue.js
1个回答
0
投票

这不是答案,但内容太长,无法添加为评论

如果您尝试使用简单的HTML / JavaScript页面创建用户,即不在您的vue.js应用程序中,会发生什么?

您可以使用以下HTML页面。只需将配置值调整为项目的值,然后在浏览器中打开即可。

<!DOCTYPE html>
<html>

<head>
  <script src="https://www.gstatic.com/firebasejs/5.0.3/firebase-app.js"></script>
   <script src="https://www.gstatic.com/firebasejs/5.0.3/firebase-auth.js"></script>
</head>

<body>

<script>
  // Initialize Firebase
  var config = {
    apiKey: "....",
    authDomain: "....",
    databaseURL: "....",
    projectId: "....",
    storageBucket: "....",
    messagingSenderId: "...."
  };
  firebase.initializeApp(config);


  firebase.auth().createUserWithEmailAndPassword("[email protected]", "myuserpassword")
        .then((userCredential) => {  
            console.log(userCredential); 
            user = userCredential.user;
            console.log(user);  
         }).catch(function(error) {
                // Handle Errors here.
                var errorCode = error.code;
                var errorMessage = error.message;
                if (errorCode == 'auth/weak-password') {
                  alert('The password is too weak')
                } else {
                  alert(errorMessage)
                }
                console.log(error)
         });


</script>

<body>
</html>
© www.soinside.com 2019 - 2024. All rights reserved.