无法启用电子邮件/密码验证提供程序

时间:2016-06-03 13:18:20

标签: javascript angularjs firebase chat

enter image description here

我在firebase菜单中启用了电子邮件/密码登录方法。创建新用户以及登录的代码如下:

$scope.chatRef = new Firebase("https://project-497516355415797631.firebaseio.com");

$scope.login = function(){
    $scope.chatRef.authWithPassword({
      email    : "debojyoti1@gmail.com",
      password : "123456"
    }, function(error, authData) {
      if (error) {
        console.log("Login Failed!", error);
      } else {
        console.log("Authenticated successfully with payload:", authData);
      }
    });
}

$scope.createUser = function(){
    $scope.chatRef.createUser({
      email    : "bobtony@firebase.com",
      password : "correcthorsebatterystaple"
    }, function(error, userData) {
      if (error) {
        console.log("Error creating user:", error);
      } else {
        console.log("Successfully created user account with uid:", userData.uid);
      }
    });
}

仍然显示错误Error: The specified authentication provider is not enabled for this Firebase.。我做错了什么?谢谢你的时间。

1 个答案:

答案 0 :(得分:2)

您正在为项目使用旧版SDK。 "新的Firebase("等......")"适用于Firebase旧版本而非Firebase 3.0版本,您应使用此文档

https://firebase.google.com/docs/web/setup