Hi All,
I have an endpoint that accepts either params username/password or Authorization Header.
I can populate my kendoDropDownList w/o issue using params. (see code below)
var dataSourceAuthorization = new kendo.data.DataSource({
transport: {
read: 'https://restsandbox.azurewebsites.net/services/rest/gettestdata?username=test_api_user&password=Te$tUser1',
type: "GET"
}
});
$("#userList").kendoDropDownList({
dataTextField: "userId",
dataValueField: "userNumber",
dataSource: dataSourceAuthorization,
optionLabel: "Select User"
});
but when I use Authorization header, I'm getting > GET https://restsandbox.azurewebsites.net/services/rest/gettestdata 401 (Unauthorized)
(see code below)
var dataSourceAuthorization = new kendo.data.DataSource({
transport: {
type: "GET",
beforeSend: function (res) {
res.setRequestHeader('Authorization', 'Bearer Te$t_T0ken');
}
}
});
$("#userList").kendoDropDownList({
dataTextField: "userId",
dataValueField: "userNumber",
dataSource: dataSourceAuthorization,
optionLabel: "Select User"
});
Please note that using same Authorization header value with Postman, its working fine. (See attached)
Did I use sendBefore incorrectly? Any idea why its not working with Headers?
Thanks!
Ryan