ESA (ember-simple-auth) The route login was not found


#1

Does ESA suppose the app to always have login route ?

router.js:938 Error while processing route: dashboard Assertion Failed: The route login was not found Error: Assertion Failed: The route login was not found
    at new EmberError (http://localhost:4200/assets/vendor.js:24386:25)
    at assert (http://localhost:4200/assets/vendor.js:24629:15)
    at Class._doTransition (http://localhost:4200/assets/vendor.js:44455:111)
    at Class.transitionTo (http://localhost:4200/assets/vendor.js:44178:19)
    at Class.transitionTo (http://localhost:4200/assets/vendor.js:43229:51)
    at Class.triggerAuthentication (http://localhost:4200/assets/vendor.js:145047:12)
    at Class.beforeModel (http://localhost:4200/assets/vendor.js:145027:14)
    at Class.superWrapper [as beforeModel] (http://localhost:4200/assets/vendor.js:56445:22)
    at applyHook (http://localhost:4200/assets/vendor.js:61471:30)
    at C.runSharedModelHook (http://localhost:4200/assets/vendor.js:62069:20)

I have a link pointing to dashboard route in my navbar:

<li>
        {{#link-to 'dashboard' classNames='menu-text' }}<i class="fi-home"></i><span>Home</span>{{/link-to}}
      </li>

The dashboardroute is protected:

import Route from '@ember/routing/route';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
import { inject as service } from '@ember/service';

export default Route.extend(AuthenticatedRouteMixin, {
  session:        service('session'),
  currentUser: service('current-user')
});

How is it possible to redirect to login URL if I don’t have a login route neither login template as I’m using implicit grant authenticator:

import OAuth2ImplicitGrant from 'ember-simple-auth/authenticators/oauth2-implicit-grant';

export default OAuth2ImplicitGrant.extend();

and the login URL to hit is defined in application.js controller:

import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import config from '../config/environment';

export default Controller.extend({
  session:        service('session'),
  currentUser: service('current-user'),

  actions: {
    login: function() {
      let oauthUrl = config.oauthUrl;
      let clientId = config.clientID;
      let redirectURI = `${window.location.origin}/callback`;
      let responseType = `token`;
      let scope = `profile%20openid`;
      window.location.replace(oauthUrl
                            + `?client_id=${clientId}`
                            + `&redirect_uri=${redirectURI}`
                            + `&response_type=${responseType}`
                            + `&scope=${scope}`
      );
    },
    logout() {
      this.get('session').invalidate();
    }
  }
});

#2

Configure the authenticate login route http://ember-simple-auth.com/api/classes/Configuration.html#property_authenticationRoute


Ember index and application templates