{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/212","repository_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular","labels_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/212/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/212/comments","events_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/212/events","html_url":"https://github.com/strongloop/loopback-sdk-angular/issues/212","id":142872596,"number":212,"title":"BUG:  User#getCurrent does not handle error","user":{"login":"anagrath","id":2846372,"avatar_url":"https://avatars.githubusercontent.com/u/2846372?v=3","gravatar_id":"","url":"https://api.github.com/users/anagrath","html_url":"https://github.com/anagrath","followers_url":"https://api.github.com/users/anagrath/followers","following_url":"https://api.github.com/users/anagrath/following{/other_user}","gists_url":"https://api.github.com/users/anagrath/gists{/gist_id}","starred_url":"https://api.github.com/users/anagrath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anagrath/subscriptions","organizations_url":"https://api.github.com/users/anagrath/orgs","repos_url":"https://api.github.com/users/anagrath/repos","events_url":"https://api.github.com/users/anagrath/events{/privacy}","received_events_url":"https://api.github.com/users/anagrath/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/labels/triage","name":"triage","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"davidcheung","id":1787590,"avatar_url":"https://avatars.githubusercontent.com/u/1787590?v=3","gravatar_id":"","url":"https://api.github.com/users/davidcheung","html_url":"https://github.com/davidcheung","followers_url":"https://api.github.com/users/davidcheung/followers","following_url":"https://api.github.com/users/davidcheung/following{/other_user}","gists_url":"https://api.github.com/users/davidcheung/gists{/gist_id}","starred_url":"https://api.github.com/users/davidcheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidcheung/subscriptions","organizations_url":"https://api.github.com/users/davidcheung/orgs","repos_url":"https://api.github.com/users/davidcheung/repos","events_url":"https://api.github.com/users/davidcheung/events{/privacy}","received_events_url":"https://api.github.com/users/davidcheung/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2016-03-23T06:17:59Z","updated_at":"2016-05-10T23:22:53Z","closed_at":null,"body":"Reproduce steps:\r\n1.) Login with a user\r\n2.) Go directly to DB and remove access token for that user\r\n3.) Go to secure page and print isAuthenticated\r\n\r\nExpected: isAuthenticated should be false\r\nActual: isAuthenticated is true\r\n\r\nThe issue can be resolved fairly easily.  The currentUserData is null because authentication fails from server side.  If currentUserData is null, we should clear the currentUserId so that isAuthenticated becomes false.\r\n\r\nSee generated code:\r\n```\r\n        \"getCurrent\": {\r\n           url: urlBase + \"/Users\" + \"/:id\",\r\n           method: \"GET\",\r\n           params: {\r\n             id: function() {\r\n              var id = LoopBackAuth.currentUserId;\r\n              if (id == null) id = '__anonymous__';\r\n              return id;\r\n            },\r\n          },\r\n          interceptor: {\r\n            response: function(response) {\r\n              LoopBackAuth.currentUserData = response.data;\r\n              return response.resource;\r\n            }\r\n          },\r\n          __isGetCurrentUser__ : true\r\n        }\r\n      }\r\n    );\r\n```"},"comment":{"url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/comments/218320393","html_url":"https://github.com/strongloop/loopback-sdk-angular/issues/212#issuecomment-218320393","issue_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/212","id":218320393,"user":{"login":"davidcheung","id":1787590,"avatar_url":"https://avatars.githubusercontent.com/u/1787590?v=3","gravatar_id":"","url":"https://api.github.com/users/davidcheung","html_url":"https://github.com/davidcheung","followers_url":"https://api.github.com/users/davidcheung/followers","following_url":"https://api.github.com/users/davidcheung/following{/other_user}","gists_url":"https://api.github.com/users/davidcheung/gists{/gist_id}","starred_url":"https://api.github.com/users/davidcheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidcheung/subscriptions","organizations_url":"https://api.github.com/users/davidcheung/orgs","repos_url":"https://api.github.com/users/davidcheung/repos","events_url":"https://api.github.com/users/davidcheung/events{/privacy}","received_events_url":"https://api.github.com/users/davidcheung/received_events","type":"User","site_admin":false},"created_at":"2016-05-10T23:22:53Z","updated_at":"2016-05-10T23:22:53Z","body":"Thanks! @anagrath "}}