我正在尝试使用 AngularFire 身份验证将我的用户登录到 Facebook。当我单击登录时,我看到错误事件触发 - angularFireAuth:error 但 err 数组为空。我不知道出了什么问题或如何调试。有任何想法吗?
看法:
<div ng-controller="UsersCtrl">
<div id="loginDiv">
<a href="#" ng-click="logout()">Logout</a>
<span ng-show="user">
{{user.name}}
<a href="#" ng-click="logout()">Logout</a>
</span>
<a href="#" ng-hide="user" ng-click="login()">Login</a>
</div>
</div>
控制器:
myApp.controller('UsersCtrl', ['$scope', 'angularFireAuth',
function UsersCtrl($scope, angularFireAuth) {
var url = 'https://inviter-dev.firebaseio.com';
angularFireAuth.initialize(url, {scope: $scope, name: "user"});
$scope.login = function() {
console.debug("logging in")
angularFireAuth.login("facebook");
};
$scope.logout = function() {
angularFireAuth.logout();
};
$scope.$on("angularFireAuth:login", function(evt, user) {
console.debug("login event", user)
});
$scope.$on("angularFireAuth:logout", function(evt) {
console.debug("logout event", user)
});
$scope.$on("angularFireAuth:error", function(evt, err) {
console.debug("auth error", err)
// There was an error during authentication.
});
}
]);