While ESA 1.0 tokens are not automatically added to every request.
If you use an OAuth2 authorizer to add authorization information to Ember data requests, follow these steps:
// app/adapters/application.js import DS from 'ember-data'; import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin'; export default DS.JSONAPIAdapter.extend(DataAdapterMixin, { authorizer: 'authorizer:some' });
If you also want to make a manual jQuery call, then something like this
this.get('session').authorize('authorizer:oauth2', (headerName, headerValue) => { Ember.$.ajax({ url: myUrl, beforeSend: function(xhr) { xhr.setRequestHeader(headerName, headerValue); }, method: 'POST', contentType: 'application/json; charset=utf-8', dataType: 'json', data: JSON.stringify({
then provides the addition of authorization information to the header.
The above comes from the main readme at https://github.com/simplabs/ember-simple-auth , and api docs at http://ember-simple-auth.com/api/
source share