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.
Unfortunately, activation email could not send to your email. Please try again.

DataManager how to access ODataController with AuthorizeAttribute

Thread ID:





117038 Jul 27,2014 08:55 AM Jul 28,2014 09:45 AM JavaScript 1
Tags: ejGrid
Asked On July 27, 2014 08:55 AM

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

Yogeshwaran [Syncfusion]
Replied On July 28, 2014 09:45 AM

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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.