使用AngularJS / AngularFire的Firebase身份验证问题[重复]

时间:2022-09-15 11:53:51

This question already has an answer here:

这个问题在这里已有答案:

I am getting an error response from my firebase when trying to make a registration form to register a user. I am using angularjs and angularfire.

在尝试创建注册表单以注册用户时,我的firebase收到了错误响应。我正在使用angularjs和angularfire。

The error I get is:

我得到的错误是:

The specified authentication provider is not enabled for this Firebase.

未为此Firebase启用指定的身份验证提供程序。

Here is my form:

这是我的表格:

Register.html

    <form name="registrationForm" ng-submit="register()" novalidate>
  <div class="form-group">
    <label for="exampleInputEmail1">First Name</label>
    <input type="text" ng-model="user.firstname" ng-required="true" class="form-control form-control2" id="exampleInputEmail1" placeholder="First Name">
  </div>
  <div class="form-group">
    <label for="exampleInputEmail1">Last Name</label>
    <input type="text" ng-model="user.lastname" ng-required="true" class="form-control form-control2" id="exampleInputEmail1" placeholder="Last Name">
  </div>        
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <input ng-model="user.email" ng-required="true" type="email" name="email" class="form-control  form-control2" placeholder="Email">
    <p class="error" ng-show="loginForm.email.$invalid && loginForm.email.$touched">Must be valid email!</p>
  </div>
  <div class="form-group">
    <label for="exampleInputPassword1">Password</label>
    <input ng-model="user.password" ng-required="true" name="password" type="password" class="form-control  form-control2" placeholder="Password">
    <p class="error" ng-show="loginForm.password.$invalid && loginForm.password.$touched">Must enter a password!</p>
  </div>
  <button ng-disabled="registrationForm.$invalid" type="submit" class="btn btn-default">Submit</button>
  <p style="margin-top: 5px;">or <span style="font-size: 14px"><a href="#/login">Login</a></span></p>
</form>

Here is my registration function that is being called when I submit my form, and what is returning the error on submit:

这是我提交表单时调用的注册函数,以及在提交时返回错误的内容:

Controllers.js

    $scope.register = function() {
    auth.$createUser({
      email: $scope.user.email,
      password: $scope.user.password
    }).then(function(regUser){
      $scope.message = "Hey, " + $scope.user.firstname + ", you're registered!";
    }).catch(function(error){
      $scope.message = error.message;
    });  //create user
  };     //register

I made sure to enable email/password authentication in my firebase settings, so I do not know why I am getting this response.

我确保在我的firebase设置中启用电子邮件/密码身份验证,因此我不知道为什么我会收到此响应。

Thanks for any help

谢谢你的帮助

1 个解决方案

#1


0  

I figured out why I was receiving the error. The syntax I used above is only for firebase databases that have been created with the legacy console. In order to enable email/password authentication for the new version of Firebase, you must follow the steps listed here

我弄清楚为什么我收到错误。我上面使用的语法仅适用于使用旧版控制台创建的firebase数据库。要为新版本的Firebase启用电子邮件/密码身份验证,您必须按照此处列出的步骤操作

#1


0  

I figured out why I was receiving the error. The syntax I used above is only for firebase databases that have been created with the legacy console. In order to enable email/password authentication for the new version of Firebase, you must follow the steps listed here

我弄清楚为什么我收到错误。我上面使用的语法仅适用于使用旧版控制台创建的firebase数据库。要为新版本的Firebase启用电子邮件/密码身份验证,您必须按照此处列出的步骤操作