
I am using the extension Angular-satellizerfor the login / registration function, but I am stuck at number 7.
The token was saved in localStorage, but I am refreshing the page and the function $auth.isAuthenticated()returns false.

.controller('loginCtrl', function($scope, $state, $auth, jwtHelper) {
$scope.login = function() {
$auth.login($scope.user)
.then(function(response) {
var gelenToken = response.data;
var tokenPayload = jwtHelper.decodeToken(gelenToken.token);
console.log(JSON.stringify(tokenPayload));
localStorage.setItem('token', JSON.stringify(tokenPayload));
$state.go('baba.manga');
})
};
})
source
share