Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Ember from 'ember';
import ToriiAuthenticator from 'ember-simple-auth/authenticators/torii';
const { inject: { service } } = Ember;
export default ToriiAuthenticator.extend({
torii: service(),
ajax: service(),
authenticate() {
const ajax = this.get('ajax');
return this._super(...arguments).then(data => {
return ajax.request('http://localhost:8888/v1/github/token', {
type: 'POST',
dataType: 'json',
data: {
authorization_code: data.authorizationCode
}
}).then(({access_token}) => {
return ajax.request('http://localhost:8888/v1/buckets/default', {
type: 'GET',
headers: {
import Ember from 'ember';
import ToriiAuthenticator from 'ember-simple-auth/authenticators/torii';
import fetch from 'fetch';
export default ToriiAuthenticator.extend({
torii: Ember.inject.service(),
authenticate() {
let config = Ember.getOwner(this).resolveRegistration('config:environment');
let tokenExchangeUri = config.cardstack.tokenURL;
return this._super(...arguments).then((data) => {
return fetch(tokenExchangeUri, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
authorizationCode: data.authorizationCode
})
}).then(response => response.json()).then(response => {
return {