I can't figure out why my Kendo Autocomplete widget is not sending the authorization headers in the request to the server:
var dataSource = new kendo.data.DataSource({ type: 'odata', serverFiltering: true, transport: { read: { url: myApiUrl, type: 'GET', beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', myAuthorizationValue); } } }});$('#myAutocompleteField').kendoAutoComplete({ dataTextField: 'fieldName', filter: 'contains', minLength: 3, dataSource: dataSource});When I check the server response in dev tools, I am getting a 401 Unauthorized error from the server. Looking at the Request Headers, I don't see the Authorization property at all.
What do I need to do to get the Authorization header to be included with the request?
If I just do a typical $.ajax request with the same object as transport.read in the Kendo DataSource parameter, it sends the headers and I get a successful response.
$.ajax({ url: myApiUrl, type: 'GET', beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', myAuthorizationValue); }, success: function(res) { console.log('success!'); console.log(res); }});