ember-cli-rails-oauth-example
ember-cli-rails-oauth-example copied to clipboard
Update frontend example app
Update frontend example app using ember-simple-auth-torii
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: 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.
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.
Sure, would be cool if you integrated the flow described above into this example.