2

I am following the example here, and I have this in my config/environment.js file:

ENV['simple-auth'] = {
  authorizer: 'simple-auth-authorizer:devise',
  routeAfterAuthentication: 'landing-pages'
};

However, after my app authenticates it tries to go to the index route. I confirmed the configuration variable used had index as the routeAfterAuthentication property by adding a breakpoint in the sessionAuthenticationSucceeded method of the library.

I tried importing the configuration in the environment.js file ES6-style, but that doesn't seem possible.

Sam Selikoff
  • 12,366
  • 13
  • 58
  • 104

2 Answers2

1

Ember Simple Auth actually still relies on the window.ENV configuration variable, so you'll need to add it to your configuration. Do it like this:

  window.MyAppENV = {{ENV}};
+ window.ENV = window.MyAppENV;
  window.EmberENV = window.MyAppENV.EmberENV;
Sam Selikoff
  • 12,366
  • 13
  • 58
  • 104
  • I had a similar situation with ember-cli and the simple-auth test library, added this to my tests/index.html and it now picks up the environment config as expected. – onions Aug 20 '14 at 09:54
0

When used with the Ember CLI Simple Auth addon, Ember Simple Auth uses the ENV['simple-auth'] configuration set in config/environment.js like below:

...

  var ENV = {
    ...
  };

  ENV['simple-auth'] = {
    routeAfterAuthentication: 'some.route.name.you.choose'
  };

  ...
Eliot Sykes
  • 9,616
  • 6
  • 50
  • 64