when i do this curl request: ( I removed password and username because of privacy)
curl -i -s -k -X $'POST' \
-H $'Host: onlineservice.klarmobil.de' -H $'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0' -H $'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H $'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H $'Accept-Encoding: gzip, deflate' -H $'Referer: https://www.klarmobil.de/' -H $'Content-Type: application/x-www-form-urlencoded' -H $'Content-Length: 81' -H $'Cookie: _gali=kundenlogin' -H $'Connection: close' -H $'Upgrade-Insecure-Requests: 1' \
-b $'_gali=kundenlogin' \
--data-binary $'lmaction=doLogin&username=XXX&password=XXX' \
$'https://onlineservice.klarmobil.de/login'
i get this as response:
When i do the same request with XMLHttpRequest with react native like this:
var http = new XMLHttpRequest();
var url = 'https://onlineservice.klarmobil.de/login';
var params = 'lmaction=doLogin&username=XXX&password=XXX';
http.withCredentials = true;
http.open('POST', url, true);
http.setRequestHeader('Host', 'onlineservice.klarmobil.de');
http.setRequestHeader('User-Agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0');
http.setRequestHeader('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8');
http.setRequestHeader('Accept-Language', 'de,en-US;q=0.7,en;q=0.3');
http.setRequestHeader('Accept-Encoding', 'gzip, deflate');
http.setRequestHeader('Referer', 'https://www.klarmobil.de/');
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http.setRequestHeader('Content-Length', '81');
http.setRequestHeader('Connection', 'close');
http.setRequestHeader('Upgrade-Insecure-Requests', '1');
http.setRequestHeader('Cookie', '_gali=kundenlogin');
http.onreadystatechange = function () {
console.log('----------http--------------------------');
console.log(http);
console.log('------------------------------------');
}
http.send(params);
i get this as reponse:
So my question is: Why i am getting the login cookie (kmPost) with curl but not with XMLHttpRequest?
I want to simulate a login and for that i need the login cookies to get the html code from the webpage.
Comments
Post a Comment