在Angular Fire Auth后没有得到回应 [英] Not getting response after Angular Fire Auth

查看:134
本文介绍了在Angular Fire Auth后没有得到回应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用angularfire注册用户后,我没有得到回应。用户电子邮件出现在Angular的身份验证库中,但是登录行是空的,似乎不执行console.log函数。

这是我的代码,希望你能帮助我。感谢。


$ b $

  app.controller('UserRegisterCtrl',[$ scope,$ http,$ firebaseAuth, 
函数($ scope,$ http,$ firebaseAuth){

$ scope.createUser = function(user_data){
var Auth = $ firebaseAuth();
Auth。$ createUserWithEmailAndPassword(user_data.email,user_data.password)
.then(function(firebaseUser){
//这部分代码不执行
console.log(firebaseUser);
console.log(User+ firebaseUser.uid +created successfully!);
$ b $)} catch(function(error){
console.error(错误:,error);
});
};
}]);

我正在使用这些库

 < script src =https://www.gstatic.com/firebasejs/live/3.0/firebase.js >< /脚本> 

< script src =https://cdn.firebase.com/libs/angularfire/2.0.0/angularfire.min.js>< / script>

我正在使用新的控制台。感谢

在Google Chrome控制台中,我为signupNewUser请求获取了这些信息:

  {
种: identitytoolkit#SignupNewUserResponse,
idToken:eyJhbGciOiJSUzI1NiIsImtpZCI6ImZkYTFhMDhjNTAxMTM1MjRhZWQxNmJlZjQ5MzBhODI5NDQ3MmI3OTMifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vYXV0by1mbGVldCIsImF1ZCI6ImF1dG8tZmxlZXQiLCJhdXRoX3RpbWUiOjE0NjY3MTY2MjUsInVzZXJfaWQiOiJRMkNKSDBaTDVvUlBqM05MelNCNW5Qek85SnMxIiwic3ViIjoiUTJDSkgwWkw1b1JQajNOTHpTQjVuUHpPOUpzMSIsImlhdCI6MTQ2NjcxNjYyNSwiZXhwIjoxNDY2NzIwMjI1LCJlbWFpbCI6ImF4YUBjb3JyZW8uY29tIiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7InBhc3N3b3JkIjpbImF4YUBjb3JyZW8uY29tIl0sImVtYWlsIjpbImF4YUBjb3JyZW8uY29tIl19fX0.nQphfgsRlvsxEBT9AJzH9aicRAidePomQrRvXZ7lbYI0-VyuNaU2L8Nq_wH4bu-iDLkcUG-fZIy4MgGqKgIIqczqgWq0FTWnVYqTXQykSdIdcwv77g019OiL5ek82hu7pSSNOCJ-aBj1sxfRdP6OjnrGIzrxEkQ0iID2_gbcN7yb-PkRxoes9kOdX200pcO2bEb3kLbA_HyLN9lZ1RFRnjSdi2w16P3yFAiVbr75esJ3Jb0VbaWddqACXabtVXFhAUYkqO piswJZ98EKhJG3u3zVIoGGi_SJUFrvsPGgJHH9hm4yO2ejjSmDdYwkVQb3pag356m5hZOkhwdmHwQECg,
电子邮件: axa@correo.com,
refreshToken: ANflqpHqSZWPVsAE82DTF632-oVCnyGRZk2tSNKwbPOPhgudIHSsfAZa2UxkLkQwpxgWO0APmd7ZPE1hdDU2YoKADb8_0otjVRUnJPceWmj74Mwargx8sboevfloh4bmxPigxBauRuduHvOgs74vUScFCW83tUH1rWc4NXp0ppNYrMN37sqjK-PGQjlVUzONd06I-ypJqYXh,
expiresIn: 3600,
localId:Q2CJH0ZL5oRPj3NLzSB5nPzO9Js1
}

这些用于getAccountInfo请求
$ b

  {
kind:identitytoolkit#GetAccountInfoResponse,
users:[
$ blocalId:Q2CJH0ZL5oRPj3NLzSB5nPzO9Js1,
email:axa@correo.com,
emailVerified:false,
providerUserInfo:[
{
providerId:密码,
federatedId:axa@correo.com,
email:axa@correo.com,
rawId:axa@correo.com
}
],
passwordHash:UkVEQUNURUQ =,
wordUpdatedAt:1.466716625E12,
validSince:1466716625,
createdAt:1466716625000
}
]
}
< code $ <$ $ p

解决方案

我已经使用 / code>和 firebase 3.0.0 问题肯定依赖于angularfire 2.0.0 。通过更新到版本2.0.1,我能够按预期执行代码。

因此,请确保将脚本链接替换为最新的firebase和angularfire版本

 < script src =https://www.gstatic.com/firebasejs/3.0。 5 / firebase.js>< /脚本> 

< script src =https://cdn.firebase.com/libs/angularfire/2.0.1/angularfire.min.js>< / script>

工作 jsFiddle 进行演示。


I'm not getting response after register a user with angularfire. The user email appears on Angular's Authentication Base, but signed-in row is empty and seems not to execute the console.log function.

Here's my code, hope you can help me. Thanks.

    app.controller('UserRegisterCtrl', ["$scope", "$http", "$firebaseAuth", 
    function($scope, $http, $firebaseAuth){

        $scope.createUser = function(user_data) {
            var Auth = $firebaseAuth();
            Auth.$createUserWithEmailAndPassword(user_data.email, user_data.password)
            .then(function(firebaseUser){
                //This part of the code does not execute
                console.log(firebaseUser);
                console.log("User " + firebaseUser.uid + " created successfully!");

            }).catch(function(error) {
                console.error("Error: ", error);
            });
    };
}]);

I'm using these libraries

    <script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"></script>

    <script src="https://cdn.firebase.com/libs/angularfire/2.0.0/angularfire.min.js"></script>

And I'm using the new console. Thanks

In the Google Chrome Console I get these for the signupNewUser request:

{
 "kind": "identitytoolkit#SignupNewUserResponse",
 "idToken": "eyJhbGciOiJSUzI1NiIsImtpZCI6ImZkYTFhMDhjNTAxMTM1MjRhZWQxNmJlZjQ5MzBhODI5NDQ3MmI3OTMifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vYXV0by1mbGVldCIsImF1ZCI6ImF1dG8tZmxlZXQiLCJhdXRoX3RpbWUiOjE0NjY3MTY2MjUsInVzZXJfaWQiOiJRMkNKSDBaTDVvUlBqM05MelNCNW5Qek85SnMxIiwic3ViIjoiUTJDSkgwWkw1b1JQajNOTHpTQjVuUHpPOUpzMSIsImlhdCI6MTQ2NjcxNjYyNSwiZXhwIjoxNDY2NzIwMjI1LCJlbWFpbCI6ImF4YUBjb3JyZW8uY29tIiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7InBhc3N3b3JkIjpbImF4YUBjb3JyZW8uY29tIl0sImVtYWlsIjpbImF4YUBjb3JyZW8uY29tIl19fX0.nQphfgsRlvsxEBT9AJzH9aicRAidePomQrRvXZ7lbYI0-VyuNaU2L8Nq_wH4bu-iDLkcUG-fZIy4MgGqKgIIqczqgWq0FTWnVYqTXQykSdIdcwv77g019OiL5ek82hu7pSSNOCJ-aBj1sxfRdP6OjnrGIzrxEkQ0iID2_gbcN7yb-PkRxoes9kOdX200pcO2bEb3kLbA_HyLN9lZ1RFRnjSdi2w16P3yFAiVbr75esJ3Jb0VbaWddqACXabtVXFhAUYkqOpiswJZ98EKhJG3u3zVIoGGi_SJUFrvsPGgJHH9hm4yO2ejjSmDdYwkVQb3pag356m5hZOkhwdmHwQECg",
 "email": "axa@correo.com",
 "refreshToken": "ANflqpHqSZWPVsAE82DTF632-oVCnyGRZk2tSNKwbPOPhgudIHSsfAZa2UxkLkQwpxgWO0APmd7ZPE1hdDU2YoKADb8_0otjVRUnJPceWmj74Mwargx8sboevfloh4bmxPigxBauRuduHvOgs74vUScFCW83tUH1rWc4NXp0ppNYrMN37sqjK-PGQjlVUzONd06I-ypJqYXh",
 "expiresIn": "3600",
 "localId": "Q2CJH0ZL5oRPj3NLzSB5nPzO9Js1"
}

And these for the getAccountInfo request

{
 "kind": "identitytoolkit#GetAccountInfoResponse",
 "users": [
  {
   "localId": "Q2CJH0ZL5oRPj3NLzSB5nPzO9Js1",
   "email": "axa@correo.com",
   "emailVerified": false,
   "providerUserInfo": [
    {
     "providerId": "password",
     "federatedId": "axa@correo.com",
     "email": "axa@correo.com",
     "rawId": "axa@correo.com"
    }
   ],
   "passwordHash": "UkVEQUNURUQ=",
   "passwordUpdatedAt": 1.466716625E12,
   "validSince": "1466716625",
   "createdAt": "1466716625000"
  }
 ]
}

解决方案

I have tested your code using angularfire 2.0.0 and firebase 3.0.0 and the problem surely relies on angularfire 2.0.0. By updating it to version 2.0.1 I was able to execute the code as expected.

So make sure you replace your script links to the latest firebase and angularfire version.

<script src="https://www.gstatic.com/firebasejs/3.0.5/firebase.js"></script>

<script src="https://cdn.firebase.com/libs/angularfire/2.0.1/angularfire.min.js"></script>

Working jsFiddle for demonstrating.

这篇关于在Angular Fire Auth后没有得到回应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆