firebase - Log out from restricted area without triggering security settings -
i have section requires login , role ("higher 19"). whenever logout it, get
error: permission_denied: client doesn't have permission access desired data.
reason security settings:
".read": "root.child('users').child(auth.uid).child('data').child('role').val() > 19",
my logout function:
// sign out functionality app.controller('signoutctrl', function($scope, $state, auth) { $scope.logout = function() { // go landing page $state.go('home'); // log user out auth.$unauth(); }; }); app.factory('auth', ['$firebaseauth', function($firebaseauth) { var firebase = new firebase('https://mysite.firebaseio.com/'); return $firebaseauth(firebase); }]);
the $state 'home' doesn't have reading restrictions, looks log out happens before i'm being redirected 'home'-$state, triggers security restrictions.
i guess i'm struggling understand basic concept of how log out restricted site without triggering security setting, can please explain me how properly?
i suggest unauthenticating when logout page loaded instead of before leaving restricted page.
Comments
Post a Comment