We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DataManager how to access ODataController with AuthorizeAttribute

My meas is how to pass Authorization(with Bearer token) header into request

1 Reply

YO Yogeshwaran Syncfusion Team July 28, 2014 01:45 PM UTC

Hi Kevin,


Thanks for using Syncfusion products.


Currently we have faced some issues in adding headers through datamanager. we have considered this as issue But for your requirement, we suggested you to use a simple work around to set header through extending beforeSend method in datamanager adaptor. Please find the sample code to extend beforeSend.



            var dataManger = ej.DataManager({

                url: "http://mvc.syncfusion.com/Services/Northwnd.svc/Orders/"


            $.extend(dataManger.adaptor, {

                beforeSend: function(dm, request, settings) {

                    request.setRequestHeader("Authorization", "Bearer boQtj0SCGz2GFGz"); // Add your authorization token like this

                    if (settings.url.endsWith(this.options.batch) && settings.type.toLowerCase() === "post") {

                        request.setRequestHeader("Accept", oData.multipartAccept);

                        request.setRequestHeader("DataServiceVersion", "2.0");

                        request.overrideMimeType("text/plain; charset=x-user-defined");


                    if (!dm.dataSource.crossDomain) {

                        request.setRequestHeader("DataServiceVersion", "2.0");

                        request.setRequestHeader("MaxDataServiceVersion", "2.0");




            var query = ej.Query().page(1, 20);





Please let us know if you have any concerns.



Yogesh R

Live Chat Icon For mobile
Up arrow icon