1

I am building an app with the use of ember-simple-auth.

So it looks very much like the library its doing is thing.

Here is what happens:

  1. user tries to access /dashboard but is redirected to /
  2. the route / contains the login form
  3. the user logs in with valid credentials
  4. Server responds: /token 200 0.252 ms - 52
  5. But an error message is shown: Error: Assertion Failed: The route index was not found
  6. user navigates to /dashboard and can now see the content, navigate around protected areas, and successfully log out.

My question is, how do I define /dashboard as the route instead of index? So that after successful login you are redirected to /dashboard

odinp123
  • 35
  • 13

2 Answers2

3

You can configure Ember Simple Auth's routeAfterAuthentication in the config, e.g.

ENV['ember-simple-auth'] = {
  routeAfterAuthentication: 'dashboard'
}
Charney Kaye
  • 3,667
  • 6
  • 41
  • 54
marcoow
  • 4,062
  • 1
  • 14
  • 21
  • Hi marcoow, I just found that out as well. After changing the routeAfterAuthentication I stumbled upon some really weird bahaviour. I am making a new question and accepting your answer. – odinp123 Nov 13 '16 at 15:29
0

4 years later...

On Ember Simple Auth Part, you can add routeAfterAuthentication and call it a day, because of ESA default to index.

If we dig deeper, as far as why ESA was and still defaults to the Index route, is that Ember always generates 2 routes for you:

  • one "" for ApplicationRoute
  • and "/" for IndexRoute,

You get these 2 routes for free.

enter image description here I found 3.20 version doc's wording is verbose, so I'm pasting from 1.10 doc, but the idea remains the same

On that perspective, ESA uses IndexRoute as default is a safe bet.

Alan Dong
  • 3,981
  • 38
  • 35