1

How would I go about logging a user in using ember simple auth without redirect them?

The authentication code looks like this:

session.authenticate(
  'authenticator:oauth2-password-grant',
  identification,
  password,
  ['read', 'write']
)

However, it redirects because of the config in my environment.js file:

ENV['ember-simple-auth'] = {
  authenticationRoute: 'login',
  routeAfterAuthentication: 'accounts.index',
  routeIfAlreadyAuthenticated: 'accounts.index'
};

Is there a parameter or something I can add to the authentication call to bypass this routerAfterAuthentication?

ancoanco
  • 220
  • 6
  • 17

1 Answers1

1

In application route, override sessionAuthenticated method.

The transition to routeAfterAuthentication is done there, because you use ApplicationRouteMixin

//routes/application.js

...
sessionAuthenticated(){
  //do nothing or whatever
}
...
Ebrahim Pasbani
  • 9,168
  • 2
  • 23
  • 30