0
我與離子和火力點和我'有工作在我看來登錄的問題。驗證始終活躍在離子與火力地堡
登錄視圖,總是顯示爲驗證,但在這種觀點的用戶尚未
我需要做的,未經驗證的展現這種觀點有什麼記錄?因爲用戶還未出現
PS記錄:我使用Facebook的社交認證。
.controller('BeforeLoginCtrl', function($scope, $state, $rootScope, $firebaseAuth, Auth) {
/*$scope.login = function() {
$state.go('login');
};
$scope.signUp = function() {
$state.go('signup');
};*/
Auth.$onAuth(function(authData){
if (authData === null) {
console.log("No autheticathed");
} else {
console.log("Authenticated");
/*$state.go('tab.dash');*/
}
$scope.authData = authData;
});
$scope.loginFacebook = function(){
Auth.$authWithOAuthRedirect("facebook").then(function(authData) {
}).catch(function(error) {
if (error.code === 'TRANSPORT_UNAVAILABLE') {
Auth.$authWithOAuthpopup("facebook").then(function(authData){
});
} else {
console.log(error);
}
});
};
})
.factory('Auth', function($firebaseAuth) {
var endpoint = "https://<NAME>.firebaseio.com/users";
var usersRef = new Firebase(endpoint);
return $firebaseAuth(usersRef);
});
如果'驗證。$ onAuth(函數(的authData)'爲您提供了權威性的數據,你可以相當肯定的是,用戶實際上認證。請記住,火力地堡「記住」頁面過渡之間的認證狀態。如果你想強制用戶註銷,調用['$ unauth()'](https://www.firebase.com/docs/web/libraries/angular/api.html#angularfire-users-and-authentication-unauth) –
謝謝你的解釋!我叫'$ unauth()',它工作。 –
我打算在這個問題上投票結束,但其他人可能會有相同的期望,所以我把它變成了答案。 –