HI,
i created a server odataLoginTestServer.zip (218.2 KB)
in Delphi 10.2 (RemObjects SDK Version 9.3.105.1345) and i trying to get the data by odata request using javascript.
Since the server requires authentication , i trying to pass the auth params to the server by following code :
$.ajax({
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa("user" + ":" + "pw"));
},
url: "http://10.18.18.82:8099/odata/",
type: "GET",
success: function (response, status) {
console.log(response);
}
});
And then I hit this problem :
i also try follwing code and hit another problem:
$.ajax({
xhrFields: {
withCredentials: true
},
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'Basic ' + btoa('test:test'));
},
url: "http://10.18.18.82:8085/odata/"
});
So how can i access the odata with authorization by using ajax?
Thank