After my previous question about ember-simple-auth and torii, I successfully authenticate my users with their Facebook accounts.
But currently, torii\'s provider fac
I used this:
import Ember from 'ember';
import Torii from 'ember-simple-auth/authenticators/torii';
import ENV from "../config/environment";
const { inject: { service } } = Ember;
export default Torii.extend({
torii: service(),
ajax: service(),
authenticate() {
const ajax = this.get('ajax');
return this._super(...arguments).then((data) => {
return ajax.request(ENV.APP.API_HOST + "/oauth/token", {
type: 'POST',
dataType: 'json',
data: { 'grant_type': 'assertion', 'auth_code': data.authorizationCode, 'data': data }
}).then((response) => {
return {
access_token: response.access_token,
provider: data.provider,
data: data
};
}).catch((error) => {
console.log(error);
});
});
}
});