Hello I’m trying to get some data from a server, is ok to signin and get data in ajax, this is my code:
JS AJAX
// SIGNIN
$.ajax({
url: WSROOT + "ethAccount.asmx/SignIn",
data: { email : email, password: pwd},
success: function (retval, textStatus) {
console.log( JSON.stringify(retval));
},
error: function (xhr, textStatus, exception) {
console.log("error");
}
});
// FETCH DATA
$.ajax({
url: WSROOT + "ethClient.asmx/GetTagList",
type: "POST",
contentType: "application/json; charset=utf-8",
cache: false,
dataType: "json",
xhrFields: { withCredentials: true },
success: function (retval, textStatus) {
console.log( JSON.stringify(retval));
}
});
I’m trying to do the same in fusetools:
//SIGNIN
var body = { "email" : "my@email.com", "password" : "mypass" };
fetch("https://www.mytaglist.com/ethAccount.asmx/SignIn", {
method: 'post',
body: JSON.stringify(body),
headers: new Headers({ 'Content-Type': 'application/json' })
})
.then(function(response) { return response.json(); })
.then(function(responseObject) { console.log(JSON.stringify(responseObject)); })
.catch(function(error){ console.log("Error: " + error); });
//FETCH DATA
fetch( WSROOT + "ethClient.asmx/GetTagList", {
method: 'post',
headers: new Headers({
'Content-Type': 'application/json; charset=utf-8',
'cache': 'false',
'dataType': 'json',
'xhrFields': '{ withCredentials: true }',
})
})
.then(function(response) { return response.json(); })
.then(function(responseObject) { console.log(JSON.stringify(responseObject));})
.catch(function(error){ console.log("Error: " + error); });
In fusetools I get the cookie but I don’t get data back afger the second call:
Output: {“Message”:“Authentication failed.”,“StackTrace”:null,“ExceptionType”:“System.InvalidOperationException”}
What am I doing wrong?, thanks.