This is a migrated thread and some comments may be shown as answers.

WEB.API DataSource Cross Domain with Authentication Header

2 Answers 184 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dustin
Top achievements
Rank 2
Dustin asked on 17 Jun 2013, 01:57 PM
Is it possible to use WEB.API as the datasource when its cross domain and needs an Authorization header set?

I know you can do cross domain with jsonp, but I read in another thread that with jsonp you can't use the beforeSend - setRequestHeader.

var aumData = new kendo.data.DataSource({
                   transport: {
                       read: {
                           url: '<%=Common.GetAppSetting("WebApiBaseUrl") %>Portfolio/Clients/Value',
                           dataType: "jsonp",
                           beforeSend: function (req) {
                               req.setRequestHeader("Authorization", "<%= this.webApiToken %>");
                           }
                       }
                   }
                });

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 18 Jun 2013, 06:18 AM
Hello,

 Indeed JSONP cannot set HTTP headers. You need to use JSON request which requires additional configuration to work cross-domain and won't work in all browsers. More info can be found here.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Michael
Top achievements
Rank 1
answered on 31 Jan 2014, 08:19 PM
Just had to comment on your profile pic, made my day man .... good stuff lol
Tags
Grid
Asked by
Dustin
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Michael
Top achievements
Rank 1
Share this question
or