I am building a site using Ember Simple Auth.
I followed these instructions to try and add the current user object to the session and it worked, using this slightly adapted code:
import Ember from 'ember';
import Session from 'simple-auth/session';
export default {
  name: "current-user",
  before: "simple-auth",
  initialize: function(container) {
    Session.reopen({
      setCurrentUser: function() {
        var accessToken = this.get('secure.token');
        var _this = this;
        if (!Ember.isEmpty(accessToken)) {
          return container.lookup('store:main').find('user', 'me').then(function(user) {
            _this.set('content.currentUser', user);
          });
        }
      }.observes('secure.token'),
      setAccount: function() {
        var _this = this;
        return container.lookup('store:main').find('account', this.get('content.currentUser.account.content.id')).then(function(account) {
          _this.set('content.account', account);
        });
      }.observes('content.currentUser'),
    });
  }
};
However, using the latest version of Ember I'm getting the following:
DEPRECATION:
lookupwas called on a Registry. TheinitializerAPI no longer receives a container, and you should use aninstanceInitializerto look up objects from the container. See http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers for more details.
I know that I need to split the above into /app/initializers and /app/instance-initializers (as per the notes here) but I'm not quite sure how to go about it.
Of course, if there is an easier/cleaner way to make the user and account objects available to every route/template I'd love to hear them :)
Thanks
 
                        
This works for me on:
Note:
1) Customize session
2) Inject store to session by initializer (otherwise find() wouldn't work)
3) In template
Note: this does not relieve you from deprecations generated by
ember-simple-authitself.