I want to automatically download a file (that's behind a login) every hour and then process it further. I can't seem to get the login right.
First I do a GET with one HTML Connector on this URL: https://b2b.cube.eu/Account/Login?ReturnUrl=%2fMyCube%2fV2%2fBackorder%2fIndex%2f0%3fart%3d1%26OnlyPromptly%3dfalse%26OnlyReady%3dfalse%26sstr%3d%26IDLfrAdr%3d%26ipp%3d150%26sort%3d0%26desc%3dfalse%26save%3dtrue&art=1&OnlyPromptly=false&OnlyReady=false&sstr=&IDLfrAdr=&ipp=150&sort=0&desc=false&save=true
The one GET-parameter ReturnUrl is the file I want to download, but since I have to follow the 302 manually, I'm not sure whether it is actually useful to leave it in. Anyway, shouldn't affect the outcome.
Reponse:
"statusCode": 200,
"headers": {
"Pragma": "no-cache",
"X-AspNetMvc-Version": "5.2",
"X-Frame-Options": "SAMEORIGIN",
"Request-Context": "appId=cid-v1:d9a0c4f9-bc3e-46e0-a60f-f9e6681fb42d",
"Access-Control-Expose-Headers": "Request-Context",
"Vary": "Accept-Encoding",
"Cache-Control": "no-store, must-revalidate, no-cache",
"Date": "Wed, 03 Mar 2021 13:13:36 GMT",
"Set-Cookie": "ASP.NET_SessionId=ml25uyoj3h1lfdpxu53mypsn; path=/; HttpOnly; SameSite=Lax,HASH_ASP.NET_SessionId=65B2250EBD1A7ECD809FEC49F4B48D3216766ADB; path=/; HttpOnly; HASH_SameSite=410086B490421B753EFDE3A7215CB6A147EC12F2,ASP.NET_SessionId=ml25uyoj3h1lfdpxu53mypsn; path=/; HttpOnly; SameSite=Lax,HASH_ASP.NET_SessionId=65B2250EBD1A7ECD809FEC49F4B48D3216766ADB; path=/; HttpOnly; HASH_SameSite=410086B490421B753EFDE3A7215CB6A147EC12F2,__RequestVerificationToken=0VqHtmj2isIrwtKtkX-yxpeKVcRS2ceRwhrhJsArv2Q6MvVZ0V50KkxOzqSoGF_dMv4IilMqeC4QEjT84iQJJZAlcCeyTuWLd_W02f8YwKY1; path=/; HttpOnly,HASH___RequestVerificationToken=4C3686E3543D8BE985C864AEA254D423CF09EB8B; path=/; HttpOnly",
"Server": "Apache",
"X-AspNet-Version": "4.0.30319",
"X-Powered-By": "ASP.NET",
"Keep-Alive": "timeout=15, max=100",
"Connection": "Keep-Alive",
"Transfer-Encoding": "chunked",
"Content-Type": "text/html; charset=utf-8",
"Expires": "-1",
"Content-Length": "15079"
}
This is the form in the HTML body of the response (I've deleted some parts that are just for optics):
<form action="/Account/Login?ReturnUrl=%2FMyCube%2FV2%2FBackorder%2FIndex%2F0%3Fart%3D1%26OnlyPromptly%3Dfalse%26OnlyReady%3Dfalse%26sstr%3D%26IDLfrAdr%3D%26ipp%3D150%26sort%3D0%26desc%3Dfalse%26save%3Dtrue" method="post">
<input name="__RequestVerificationToken" type="hidden" value="k878Z-rJBi6rYnvy9RLTPEd5SVEJbqgykKRk9ppcaNnNIUZXWQ8LBYRRZJBZHtHyzd5zdAPP4ZnQ6OvAicogvYEBlGmSqOcNYwHtboylyww1" />
<input name="LogOn.UserName" type="text" value="" />
<input name="LogOn.Password" type="password" />
<button type="submit">Anmelden</button>
</form>
I then extract the the hidden input in the form and feed them into a second HTTP Connector, that does a POST on the same URL with this body:
__RequestVerificationToken=k878Z-rJBi6rYnvy9RLTPEd5SVEJbqgykKRk9ppcaNnNIUZXWQ8LBYRRZJBZHtHyzd5zdAPP4ZnQ6OvAicogvYEBlGmSqOcNYwHtboylyww1&LogOn.UserName=myuser&LogOn.Password=mypass
And as headers I just set "Cookie" to the extract string I get in "Set-Cookie" from the first HTTP Connector. The RequestVerificationTokens in the hidden input and in the cookie are different, but that's also the case when I login with Chrome and look at it with Developer Tools.
Instead of a 302 to the URL I put in the ReturnURL GET-parameter, I get a 200 and the login website telling me that the login failed. What am I doing wrong?
Help would be much appreciated.

Report
All responses (
Answers (