{"action":"created","issue":{"url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/102","labels_url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/102/labels{/name}","comments_url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/102/comments","events_url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/102/events","html_url":"https://github.com/lynndylanhurley/ng-token-auth/issues/102","id":55811952,"number":102,"title":"Redirect not logged in users to the login state?","user":{"login":"brunomperes","id":1819575,"avatar_url":"https://avatars.githubusercontent.com/u/1819575?v=3","gravatar_id":"","url":"https://api.github.com/users/brunomperes","html_url":"https://github.com/brunomperes","followers_url":"https://api.github.com/users/brunomperes/followers","following_url":"https://api.github.com/users/brunomperes/following{/other_user}","gists_url":"https://api.github.com/users/brunomperes/gists{/gist_id}","starred_url":"https://api.github.com/users/brunomperes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brunomperes/subscriptions","organizations_url":"https://api.github.com/users/brunomperes/orgs","repos_url":"https://api.github.com/users/brunomperes/repos","events_url":"https://api.github.com/users/brunomperes/events{/privacy}","received_events_url":"https://api.github.com/users/brunomperes/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-28T20:38:17Z","updated_at":"2015-02-17T01:38:46Z","closed_at":"2015-01-28T22:03:21Z","body":"I couldn't find on the docs how to redirect a user if they're not logged in and are trying to opening a state that requires it. I've set the `emailSignInPath` to my `ui-router` state, but I'm not sure if that's what I should do.\r\n\r\nI've found on the docs this validation to check whether if a user is logged in before opening a state, should I add a manual `$state.go()` after the promise is returned?\r\n```Javascript\r\n.state('admin', {\r\n        url: '/admin',\r\n        abstract: true,\r\n        template: '<ui-view/>',\r\n        resolve: {\r\n          auth: function($auth) {\r\n            return $auth.validateUser();\r\n          }\r\n        }\r\n      })\r\n```\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/comments/74604553","html_url":"https://github.com/lynndylanhurley/ng-token-auth/issues/102#issuecomment-74604553","issue_url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/102","id":74604553,"user":{"login":"searsaw","id":3712883,"avatar_url":"https://avatars.githubusercontent.com/u/3712883?v=3","gravatar_id":"","url":"https://api.github.com/users/searsaw","html_url":"https://github.com/searsaw","followers_url":"https://api.github.com/users/searsaw/followers","following_url":"https://api.github.com/users/searsaw/following{/other_user}","gists_url":"https://api.github.com/users/searsaw/gists{/gist_id}","starred_url":"https://api.github.com/users/searsaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/searsaw/subscriptions","organizations_url":"https://api.github.com/users/searsaw/orgs","repos_url":"https://api.github.com/users/searsaw/repos","events_url":"https://api.github.com/users/searsaw/events{/privacy}","received_events_url":"https://api.github.com/users/searsaw/received_events","type":"User","site_admin":false},"created_at":"2015-02-17T01:38:46Z","updated_at":"2015-02-17T01:38:46Z","body":"I have tried subscribing to the `auth:invalid` event, but it doesn't seem to do anything.  This is part of my `run` block:\r\n\r\n```javascript\r\n.run(function($rootScope, $state, $log) {\r\n  $rootScope.$on('auth:invalid', function(e) {\r\n    $log.log('Inside the auth:invalid handler.');\r\n    $state.go('login');\r\n  });\r\n});\r\n```\r\n\r\nIt doesn't do anything though.  I have a `resolve` setup like in the docs.  It won't show the dashboard page, like it is supposed to, but I'm trying to redirect to the login here."}}