Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs Ionic Firebase Facebook登录在浏览器中可以正常工作,但在Android上不行_Angularjs_Firebase_Ionic Framework_Firebase Authentication - Fatal编程技术网

Angularjs Ionic Firebase Facebook登录在浏览器中可以正常工作,但在Android上不行

Angularjs Ionic Firebase Facebook登录在浏览器中可以正常工作,但在Android上不行,angularjs,firebase,ionic-framework,firebase-authentication,Angularjs,Firebase,Ionic Framework,Firebase Authentication,我对爱奥尼亚还比较陌生,在android平台上使用爱奥尼亚框架登录Facebook时遇到了一些问题。它在浏览器上运行得非常好(有时当我尝试登录时,第一次尝试不起作用),但当我在Android上运行项目时,它只是重定向,不会传递到下一页 我认为问题可能是第一次登录尝试无法获取Facebook用户数据 这是我的密码: .controller('LoginCtrl', function (Backand, $state, $rootScope, $scope, LoginService, ID, na

我对爱奥尼亚还比较陌生,在android平台上使用爱奥尼亚框架登录Facebook时遇到了一些问题。它在浏览器上运行得非常好(有时当我尝试登录时,第一次尝试不起作用),但当我在Android上运行项目时,它只是重定向,不会传递到下一页

我认为问题可能是第一次登录尝试无法获取Facebook用户数据

这是我的密码:

.controller('LoginCtrl', function (Backand, $state, $rootScope, $scope, LoginService, ID, name) {

$scope.bgs = ["img/welcome-bg.jpg"];

$scope.firebaseFacebookLogIn = function(){

    var provider = new firebase.auth.FacebookAuthProvider();
    provider.addScope('user_birthday');
    provider.addScope('public_profile');
    firebase.auth().signInWithRedirect(provider);

    firebase.auth().getRedirectResult().then(function(result) {
    if (result.credential) {
        // This gives you a Facebook Access Token. You can use it to access the Facebook API.
        var token = result.credential.accessToken;
        var user = result.user;
        var uid = user.providerData[0].uid;
        var nombre = user.providerData[0].displayName;
        localStorage.setItem("Usuario", user);
        localStorage.setItem("ID", uid);
        localStorage.setItem("Nombre", nombre);
        $state.go('app.feed');
    }

    //var user = firebase.auth().currentUser;

    }).catch(function(error) {
        // Handle Errors here.
        var errorCode = error.code;
          alert(errorCode);
        var errorMessage = error.message;
          alert(errorMessage);
        // The email of the user's account used.
        var email = error.email;
          alert(email);
        // The firebase.auth.AuthCredential type that was used.
        var credential = error.credential;
          alert(credential);
        // ...
    });
};

$scope.ID = localStorage.getItem("ID");
$scope.name = localStorage.getItem("name");

$scope.facebookLogOut = function(token){
    firebase.auth().signOut().then(function() {
    // Sign-out successful.
      $state.go('auth.walkthrough');
    }, function(error) {
    // An error happened.
    });

};

})
解决了


原来我只是在项目的config.xml中缺少了一个firebase标记。。老实说,这很愚蠢,希望能对有同样问题的人有所帮助。

你能展示你的代码吗?我编辑了我的问题,请阅读-总结是,这不是一种向志愿者致辞的理想方式,可能会对获得答案产生反作用。请避免将此添加到问题中。将getRedirectResult移到scope.firebaseFacebookLogIn函数之外。它应该在页面加载后被调用,它仍然重定向到登录页面