{"action":"created","issue":{"url":"https://api.github.com/repos/DaftMonk/generator-angular-fullstack/issues/874","labels_url":"https://api.github.com/repos/DaftMonk/generator-angular-fullstack/issues/874/labels{/name}","comments_url":"https://api.github.com/repos/DaftMonk/generator-angular-fullstack/issues/874/comments","events_url":"https://api.github.com/repos/DaftMonk/generator-angular-fullstack/issues/874/events","html_url":"https://github.com/DaftMonk/generator-angular-fullstack/issues/874","id":60136906,"number":874,"title":"Authentication calling callback before the user is loaded","user":{"login":"Toub","id":367762,"avatar_url":"https://avatars.githubusercontent.com/u/367762?v=3","gravatar_id":"","url":"https://api.github.com/users/Toub","html_url":"https://github.com/Toub","followers_url":"https://api.github.com/users/Toub/followers","following_url":"https://api.github.com/users/Toub/following{/other_user}","gists_url":"https://api.github.com/users/Toub/gists{/gist_id}","starred_url":"https://api.github.com/users/Toub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toub/subscriptions","organizations_url":"https://api.github.com/users/Toub/orgs","repos_url":"https://api.github.com/users/Toub/repos","events_url":"https://api.github.com/users/Toub/events{/privacy}","received_events_url":"https://api.github.com/users/Toub/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-06T18:05:30Z","updated_at":"2015-03-14T06:25:26Z","closed_at":null,"body":"Auth.login function on client side is calling the callback to early, so the page after direction may have to watch until the user is loaded before to display the template.\r\n\r\nThis code: \r\n\r\n    currentUser = User.get();\r\n    deferred.resolve(data);\r\n    return cb();\r\n\r\nshould be replaced by:\r\n\r\n    currentUser = User.get(function () {\r\n        deferred.resolve(data);\r\n        return cb();\r\n    });\r\n\r\nand also better manage the error (but not sure if we have to call cb() in case of error here):\r\n\r\n    currentUser = User.get(function () {\r\n        deferred.resolve(data);\r\n        return cb();\r\n    }, function (err) {\r\n        deferred.deffer(err);\r\n    });"},"comment":{"url":"https://api.github.com/repos/DaftMonk/generator-angular-fullstack/issues/comments/79993192","html_url":"https://github.com/DaftMonk/generator-angular-fullstack/issues/874#issuecomment-79993192","issue_url":"https://api.github.com/repos/DaftMonk/generator-angular-fullstack/issues/874","id":79993192,"user":{"login":"Awk34","id":5545474,"avatar_url":"https://avatars.githubusercontent.com/u/5545474?v=3","gravatar_id":"","url":"https://api.github.com/users/Awk34","html_url":"https://github.com/Awk34","followers_url":"https://api.github.com/users/Awk34/followers","following_url":"https://api.github.com/users/Awk34/following{/other_user}","gists_url":"https://api.github.com/users/Awk34/gists{/gist_id}","starred_url":"https://api.github.com/users/Awk34/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Awk34/subscriptions","organizations_url":"https://api.github.com/users/Awk34/orgs","repos_url":"https://api.github.com/users/Awk34/repos","events_url":"https://api.github.com/users/Awk34/events{/privacy}","received_events_url":"https://api.github.com/users/Awk34/received_events","type":"User","site_admin":false},"created_at":"2015-03-14T06:25:26Z","updated_at":"2015-03-14T06:25:26Z","body":"This is what I have changed mine to:\r\n\r\n```javascript\r\ncurrentUser = User.get();\r\ncurrentUser.$promise.then(function() {\r\n    deferred.resolve(data);\r\n});\r\n```"}}