Answer the question
In order to leave comments, you need to log in
Ember Simple Auth Token: how to add information to header of request sent by authenticator:jwt?
Installed the authenticator:
ember install ember-simple-auth
ember install ember-simple-auth-token
export default Ember.Controller.extend({
session: Ember.inject.service(),
actions: {
login() {
var credentials = this.getProperties('identification', 'password'),
authenticator = 'authenticator:jwt';
this.get('session').authenticate(authenticator, credentials);
}
}
});
{"password":"ember","username":"ember"}
'Authorization': 'Basic ZW1iZXI6ZW1iZXI='
Answer the question
In order to leave comments, you need to log in
I looked at the sources of Ember Simple Auth Token for jwt:
https://github.com/jpadilla/ember-simple-auth-toke...
1) to change the headers during authorization, you can pass them as a third parameter:
2) in the makeRequest(url, data, headers) method, the POST method is hardcoded (i.e. changing to GET will not work).
Total: Ember Simple Auth Token is not suitable for my task.
Better not use ember-simple-auth-token. Instead, OAuth2, which comes with ember-simple-auth, will do.
You need to override the authenticate method , which is responsible for this case.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question