benefitcloud / ember-uploader

An Ember library for uploading files
MIT License
346 stars 97 forks source link

Authentication headers #184

Closed artemgurzhii closed 6 years ago

artemgurzhii commented 6 years ago

I'm using EmberUploader.Uploader to send the file to the back-end server. But I didn't find any way to add Authorization: Bearer TOKEN header to the request.

ezekg commented 6 years ago

I think you need to add that into ajaxSettings. For example:

import Uploader from 'ember-uploader/uploaders/uploader';

const uploader = Uploader.extend({
  ajaxSettings: {
    headers: {
      'Authorization': `Bearer ${TOKEN}`
    }
  }
})
artemgurzhii commented 6 years ago

@ezekg Yes, the problem was that I receive a token from the session service(get(this, 'session.token')) and I was a bit confused with this example.