I am now starting to use authentication in DataSnap. I am trying to access methods via AJAX and is returning error 401 - Unauthorized. My request is as follows:
$.ajax({
username: login,
password: pass,
async : false,
cache: "false",
dataType: 'json',
type: 'get',
url: url,
success: function(data){...}
I did this by following this question, where the only difference is that I am not using jsonp
.
When accessed by the browser, a box is displayed for user input and password, when I enter the credentials it allows me to continue.
Does anyone know how to solve?
EDIT 1
I have also tried the request using:
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', makeBaseAuth(login, pass));
}
Instead of username
and password
.