Ember-simple-auth dummy app


I tried to play a little bit with ember-simple-auth dummy app and have some questions:

  1. Why even after being authenticated with Implicit Grant authorizer, the following div block in index.hbs is still displayed:
{{#unless session.isAuthenticated}}
  <div class="alert alert-info">
    You can {{#link-to 'login' classNames='alert-link'}}log in{{/link-to}} with login <code>letme</code> and password <code>in</code>.

After the authentication is successful, the value of {{#unless session.isAuthenticated}} should be false but it is not the case.

  1. The same check works fine in another template - main-navigation.hbs:
{{#if session.isAuthenticated}}
      <a {{action 'logout'}} class="btn btn-danger navbar-btn navbar-right">Logout</a>
      {{#if sessionAccount.account}}
        <p class="navbar-text pull-right">Signed in as {{sessionAccount.account.name}}</p>
      <a {{action 'login'}} class="btn btn-success navbar-btn navbar-right">Login</a>

The button Login/Logout is displayed correctly depending of your athentication status.

  1. What does this code from main-navigation.hbs mean:
{{#if sessionAccount.account}}
      <p class="navbar-text pull-right">Signed in as {{sessionAccount.account.name}}</p>

What is account? Where and how is it set in the application ? Sure, there is a model account, but how do we fetch the data for this model and where from ?

  1. In sessions-account.js service we are finding the account as follows:
loadCurrentUser() {
    return new RSVP.Promise((resolve, reject) => {
      const accountId = this.get('session.data.authenticated.account_id');
      if (!isEmpty(accountId)) {
        this.get('store').find('account', accountId).then((account) => {
          this.set('account', account);
        }, reject);
      } else {

But where do we set the value for session.data.authenticated.account_id?

  1. What does onLogin mean in templates/application.hbsand where it comes from:
{{main-navigation onLogin='transitionToLoginRoute'}}
  1. Why do we prefix the method with underscore in routes/application.js:
beforeModel() {
    return this._loadCurrentUser();

  sessionAuthenticated() {

  _loadCurrentUser() {
    return this.get('sessionAccount').loadCurrentUser().catch(() => this.get('session').invalidate());

Thank you!


I don’t know if it helps but I have an other working Example here https://github.com/broerse/ember-cli-blog/ you can test here: https://bloggr.exmer.com/secret


@broerse, Thank you very much. The problem I actually have - is that all the examples I could find in books and on the Web use either a standard provider or a username/password authentication, - all of them are enough clear for me and I could get all of them work. In my app I’ll have to use OAuth2ImplicitGrant authenticator. And ESA dummy app where I pull most of the code from, has an issue with session authentication (I tried to run it locally as described in my earlier post). If somebody could be explain what is wrong with that, it would be really appreciated :). Thank you !