Search code examples
ember.jsember-simple-auth

Ember simple auth: how to redirect back to the last visiting route after authentication?


If user was trying to visit a /protected-route, then using ember-simple-auth after user authentication finished on /login route, how to redirect user back to the /protected-route?

There is configuration to define the route after authentication but how to accomplish something like this?


Solution

  • You should mixin the ApplicationRouteMixin into the application route and the user will transition to protected route after login.

    For more info see ApplicationRouteMixin docs at http://ember-simple-auth.com/api/classes/ApplicationRouteMixin.html and the sessionAuthenticated method