In my angularjs app, I am checking if user lands on landing page and is already authenticated, then redirect him to home page.
.state(\'landingpage\', {
.state('landingpage', {
abstract: "true",
url: "/landingpage",
templateUrl: "app/landingpage/landingpage.html",
resolve: {
AutoLoginCheck: ['$state','$window', '$q','$timeout', function ($state, $window,$q,$timeout) {
if($window.localStorage.access_token != null)
{
if($window.sessionStorage.access_token == null) {
$window.sessionStorage.access_token = $window.localStorage.access_token;
}
UserInfoService.SetUserAuthenticated(true);
$timeout(function() {
$state.go('app.home')
},0);
return $q.reject()
}
}]
}
})
This would work for you.