EasyE EasyE - 1 month ago 4x
Ajax Question

Not getting my custom header in my web api

currently looking to add a new parameter to my ajax call in order to receive it in in a web api which I am starting to develop however my custom header is not showing up when I am going through it in my Api. Currently I only see Authorization and accept coming through however my "Token" parameter is not showing up.

JavaScript/ Ajax call

type: "POST",
url: "http://localhost:64563/api/Values/Get?SiteUrl=" + SiteUrl,
dataType: "jsonp",

headers: {
"Authorization": "Bearer ",
"accept": "application/json;odata=verbose",
"Token" : "testererererzxfmnvgldk;fshgjdlfkhg"
}).done(function (response) {


For the record when using Adal the header containing the token must have the following format, if not the header will be ignored by the endpoint. This is the proper format.

  headers: {
            "Authorization": "Bearer " + sharepointToken,
             "accept": "application/json;odata=verbose"