ember-cli-rails-oauth-example icon indicating copy to clipboard operation
ember-cli-rails-oauth-example copied to clipboard

Update frontend example app

Open antonioparisi opened this issue 10 years ago • 4 comments

Update frontend example app using ember-simple-auth-torii

antonioparisi avatar Jul 28 '14 18:07 antonioparisi

I don't think that addon will help me to accomplish the same thing. I believe that it allows you to authenticate the session based on the information returned from a Torii provider.

In this application I needed to take the information retrieved by Torii and pass it along to the server as credentials in order to retrieve an access token for my api.

The goal is for users to get an access token for my server api by using a temporary authorization code received from GitHub (from Torii) in place of a username/password.

@marcoow, does this make sense?

HeroicEric avatar Jul 31 '14 00:07 HeroicEric

@HeroicEric: it probably still makes sense to use ember-simple-auth-torii - you just need to extend the authenticator and define a custom authenticate method like that:

import Ember from 'ember';
import Torii from 'simple-auth-torii/authenticators/torii';

export default Torii.extend({
  authenticate: function(provider) {
    var _this = this;
    return Ember.RSVP.Promise(function(resolve, reject) {
      _this.super(provider).then(function(data) {
        // exchange the token with your rails server here and resolve
      }, reject);
    });
  }
});

You also need to override restore of course.

marcoow avatar Jul 31 '14 06:07 marcoow

hi @marcoow I think we definitely have to do a sample app using ESA and ESA-torii, because it's a workflow really trickly actually, and it's not easy to be understood.

antonioparisi avatar Jul 31 '14 10:07 antonioparisi

Sure, would be cool if you integrated the flow described above into this example.

marcoow avatar Jul 31 '14 10:07 marcoow