The 'Authorization' header is not being set for some reason. I have tried setting the authorizer in config/environment.js with
updated:as per @marcoow suggestion
ENV['simple-auth'] = {
crossOriginWhitelist: ['*'],
authorizer: 'simple-auth-authorizer:devise'
};
ENV['simple-auth-devise'] = {
serverTokenEndpoint: 'users/sign_in',
};
...I am able to login to my application by for updating other resources like post Authorization: Token token="", user_email="" is not getting added to my sever call
controller/dashboard.js
import Ember from 'ember';
export
default Ember.Controller.extend({
actions: {
add: function () {
var name = this.get('name');
var start = this.get('Start');
var end = this.get('End');
var game = this.store.createRecord('game', {
name: name,
start: start,
end: end
});
game.save();
}
}
});
my request looks something like this
**1. MY under standing is that the request headers here should contain Authorization: header too.
login controller
import Ember from 'ember';
import LoginControllerMixin from 'simple-auth/mixins/login-controller-mixin';
export
default Ember.Controller.extend(LoginControllerMixin, {
authenticator: 'simple-auth-authenticator:devise',
actions: {
authenticate: function () {
console.log('i was called');
var self = this;
var data = this.getProperties('identification', 'password');
self.get('session').authenticate(this.get('authenticator'), data).then(function () {
self.transitionToRoute('dashboard');
}, function (error) {
console.log(error);
});
}
}
});
I can see:
How can i authorize my Model#save with devise....using ember-data
just for debugging i did this in route/dashboard.js
import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin,{
model: function() {
console.log(this.get('session.isAuthenticated')); # this is true
}
});
crossOriginWhitelist
is not a property of the Devise package - you need to configure that for the Ember Simple Auth base package:
ENV['simple-auth'] = {
crossOriginWhitelist: ['*']
};
ENV['simple-auth-devise'] = {
serverTokenEndpoint: 'users/sign_in',
authorizer: 'authorizer:devise'
};