I'm using angular-devise and I have the following service that checks whether the user is logged or not
isAuthenticated: function ($state, Auth) {
Auth.currentUser().then(function (){
console.log("user is logged");
}, function(error) {
$state.go('home',{});
console.log("user is not logged");
})
The problem is when I log the user on the server side it keeps returning that he's not logged in until I refresh the page. Then, after the refersh, it says that the user is logged as expected.
What am I missing here? Thank you!