0

I have an app that uses ember-simple-auth with the Devise authorizer.

When I was on ember-simple-auth v 0.7.x I was able to create a new user model and save it. Then in the success response, use a devise token returned from the serve to manually authorize the session like...

neweUser.save().then(function(user) {
    var authData = {
        user_token: user.get('authenticationToken'),
        token: user.get('authenticationToken'),
        user_email: user.get('email'),
        email: user.get('email'),
        user_id: user.get('id'),
        user: user
    };

    this.get('session').setup(authenticator, authData, true);
}

but now with ember-simple-auth 1.0, there doesn't seem to be a setup() method on the session service. am i missing something? any ideas how to manually authorize a session using the devise token?

benzo
  • 160
  • 1
  • 6

1 Answers1

0

setup was a private method before 1.0 already and you should not use it. Instead implement a custom authenticator and authenticate the session with that:

neweUser.save().then(function(user) {
  var authData = {
    user_token: user.get('authenticationToken'),
    token: user.get('authenticationToken'),
    user_email: user.get('email'),
    email: user.get('email'),
    user_id: user.get('id'),
    user: user
  };
  this.get('session').authenticate('authenticator:custom', authData);
}
marcoow
  • 4,062
  • 1
  • 14
  • 21