{"action":"created","issue":{"url":"https://api.github.com/repos/simplabs/ember-simple-auth/issues/764","labels_url":"https://api.github.com/repos/simplabs/ember-simple-auth/issues/764/labels{/name}","comments_url":"https://api.github.com/repos/simplabs/ember-simple-auth/issues/764/comments","events_url":"https://api.github.com/repos/simplabs/ember-simple-auth/issues/764/events","html_url":"https://github.com/simplabs/ember-simple-auth/issues/764","id":115144714,"number":764,"title":"session data not available in instance intializer. ","user":{"login":"Kilowhisky","id":7075666,"avatar_url":"https://avatars.githubusercontent.com/u/7075666?v=3","gravatar_id":"","url":"https://api.github.com/users/Kilowhisky","html_url":"https://github.com/Kilowhisky","followers_url":"https://api.github.com/users/Kilowhisky/followers","following_url":"https://api.github.com/users/Kilowhisky/following{/other_user}","gists_url":"https://api.github.com/users/Kilowhisky/gists{/gist_id}","starred_url":"https://api.github.com/users/Kilowhisky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kilowhisky/subscriptions","organizations_url":"https://api.github.com/users/Kilowhisky/orgs","repos_url":"https://api.github.com/users/Kilowhisky/repos","events_url":"https://api.github.com/users/Kilowhisky/events{/privacy}","received_events_url":"https://api.github.com/users/Kilowhisky/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-04T20:50:41Z","updated_at":"2015-11-04T21:06:19Z","closed_at":"2015-11-04T21:03:08Z","body":"I don't know if this is supposed to work or is not a supported feature but i cannot access the `session.data` content in an instance initializer.  It just returns a blank object with a bare 'authenticated' property. \r\n\r\nFor instance.\r\n\r\n```\r\nexport function initialize(instance) {\r\n\r\n    // Get the  service\r\n    var  service = instance.lookup('service:session');\r\n    var i18n = instance.lookup('service:i18n');\r\n\r\n    // Restore the locale from local storage\r\n    i18n.set('locale', service.get('data.locale') || 'en-US');\r\n\r\n    // Observe the locale changes and store them in the settings object\r\n    Ember.addObserver(i18n, 'locale', function(){\r\n        service.set('data.locale', i18n.get('locale'));\r\n    });\r\n}\r\n\r\nexport default{\r\n  name: 'restore-locale',\r\n  initialize: initialize,\r\n  after: 'ember-simple-auth'\r\n};\r\n```\r\n\r\nThrough testing i can confirm that all the initialzers are running before this block is called. "},"comment":{"url":"https://api.github.com/repos/simplabs/ember-simple-auth/issues/comments/153865388","html_url":"https://github.com/simplabs/ember-simple-auth/issues/764#issuecomment-153865388","issue_url":"https://api.github.com/repos/simplabs/ember-simple-auth/issues/764","id":153865388,"user":{"login":"marcoow","id":1510,"avatar_url":"https://avatars.githubusercontent.com/u/1510?v=3","gravatar_id":"","url":"https://api.github.com/users/marcoow","html_url":"https://github.com/marcoow","followers_url":"https://api.github.com/users/marcoow/followers","following_url":"https://api.github.com/users/marcoow/following{/other_user}","gists_url":"https://api.github.com/users/marcoow/gists{/gist_id}","starred_url":"https://api.github.com/users/marcoow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcoow/subscriptions","organizations_url":"https://api.github.com/users/marcoow/orgs","repos_url":"https://api.github.com/users/marcoow/repos","events_url":"https://api.github.com/users/marcoow/events{/privacy}","received_events_url":"https://api.github.com/users/marcoow/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T21:06:19Z","updated_at":"2015-11-04T21:06:19Z","body":"Yeah, the reason is that restoration might take some time and it needs to run after the application has booted up so a potential loading route would be displayed while restoration is in progress. If it is run in an initializer and defers application readiness you'd only see a blank page until it has finished."}}