mardi 15 mars 2016

Integrating ember-simple-auth 1.0 with ember-cli-uploader

I've recently upgraded to Ember Simple Auth 1.0. I was previously using the ember-cli-uploader addon to upload files (http://ift.tt/1Ue5Qvb). Since upgrading simple auth, uploads are no longer working as the upload requests are not authorised.

Within my app I have successfully added the following to my Ember.$.ajax requests to authorise them:

beforeSend: function(xhr){
  _this.get('session').authorize('authorizer:application', function(headerName, headerValue) {
    xhr.setRequestHeader(headerName, headerValue);
  });
}

I've tried adding this within the ember-uploader addon but I can't access the session object within the addon. Has anyone solved this problem? Is there an easy way to access the session within an addon?

Many thanks

Aucun commentaire:

Enregistrer un commentaire