I am having a jquery file which is embedded inside SharePoint on premise environment. I want to call a WCF service which has windows authentication enabled. I have enabled CORS and added the headers like ("Access-Control-Allow-Origin","requested domain"),("Access-Control-Allow-Credentials", "true") ("Cache-Control", "no-cache").
The ajax call is as below:-
//ajax
$.ajax({
url: url,
type: "POST",
data: data,
success: successCallback,
contentType: "application/json",
crossDomain: true,
xhrFields: {
withCredentials: true
},
error: errorCallback,
dataType: "json"
})
}
But making a service call is giving Unauthorized: Access is denied due to invalid credentials. I am using IE11 browser.
Can you please help me how can I pass current logged in user credential to make my service call.