HTTP Login Gate

Hey n8n-ers! I’m trying to automate a .csv retrieval from behind a http login gate. I’ve managed to do this previously, but this current login gate is not playing ball - can anyone help me see what i am doing wrong?

Here’s the http sniffer data of my successful (manual) retrieval:

Login:

Request Details Response Details
Headers
documentLifecycle active
frameType outermost_frame
initiator https://www.chickenb2b.co.uk
method POST
url https://www.chickenb2b.co.uk/
Accept text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding gzip, deflate, br
Accept-Language en-GB,en-US;q=0.9,en;q=0.8
Content-Type application/x-www-form-urlencoded
Origin https://www.chickenb2b.co.uk
Referer https://www.chickenb2b.co.uk/
sec-ch-ua “Not?A_Brand”;v=“8”, “Chromium”;v=“108”, “Google Chrome”;v=“108”
sec-ch-ua-mobile ?0
sec-ch-ua-platform “Windows”
Sec-Fetch-Dest document
Sec-Fetch-Mode navigate
Sec-Fetch-Site same-origin
Sec-Fetch-User ?1
Upgrade-Insecure-Requests 1
User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Cookies (sorted by symbols, Aa-Zz)
_fbp fb.2.1670082225740.446270937
_ga GA1.3.1342739331.1670082223
_gat 1
_gid GA1.3.712486324.1670082223
_hjid 0b87bac2-9702-4c0d-aa62-94bff45e0373
_hjSessionUser_125081 eyJpZCI6ImY3MjA5YzZhLTc2ZTQtNTA4Mi04MTUzLTA5ZmJlNTBlY2E1ZCIsImNyZWF0ZWQiOjE2NDI0NDI5ODEyMDksImV4aXN0aW5nIjp0cnVlfQ==
PHPSESSID e8ff25a726e36231df79b171695dfcf4
Body (form fields data)
loginlink
pass ****
submitted 1
user ****
Headers
documentLifecycle active
frameType outermost_frame
fromCache false
initiator https://www.chickenb2b.co.uk
ip 2606:4700:3035::ac43:be88
method POST
redirectUrl Chicken Cycle-Kit B2B
statusCode 302
statusLine HTTP/1.1 302
url https://www.chickenb2b.co.uk/
alt-svc h3=“:443”; ma=86400, h3-29=“:443”; ma=86400
cache-control no-store, no-cache, must-revalidate
cf-cache-status DYNAMIC
cf-ray 774412c78dad73e7-LHR
content-type text/html; charset=UTF-8
date Sun, 04 Dec 2022 11:06:33 GMT
expires Thu, 19 Nov 1981 08:52:00 GMT
location home.php
nel {“success_fraction”:0,“report_to”:“cf-nel”,“max_age”:604800}
pragma no-cache
report-to {“endpoints”:[{“url”:“https://a.nel.cloudflare.com/report/v3?s=7aGgBJDjSGkQY5Abn0VWhKKEE%2BuB9Xm1joIHc0Lk%2BWBQfwUpE7r2Htvor%2FJ48OdhtVE%2BdaqYbr6V%2BhGLIIcYuNJrHQaJ7pOE7CRM4I0ChFtJL6e8HgWvuhdqlTQhcv2N7h%2F6htza9tkEktRRv3SMAsHCYQ%3D%3D”}],“group”:“cf-nel”,“max_age”:604800}
server cloudflare
vary User-Agent

Feed Download initiation:

Request Details Response Details

Headers
documentLifecycle active
frameType outermost_frame
initiator https://www.chickenb2b.co.uk
method POST
url Chicken Cycle-Kit B2B
Accept text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding gzip, deflate, br
Accept-Language en-GB,en-US;q=0.9,en;q=0.8
Content-Type application/x-www-form-urlencoded
Origin https://www.chickenb2b.co.uk
Referer Chicken Cycle-Kit B2B
sec-ch-ua “Not?A_Brand”;v=“8”, “Chromium”;v=“108”, “Google Chrome”;v=“108”
sec-ch-ua-mobile ?0
sec-ch-ua-platform “Windows”
Sec-Fetch-Dest document
Sec-Fetch-Mode navigate
Sec-Fetch-Site same-origin
Sec-Fetch-User ?1
Upgrade-Insecure-Requests 1
User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Cookies (sorted by symbols, Aa-Zz)
_fbp fb.2.1670082225740.446270937
_ga GA1.3.1342739331.1670082223
_gid GA1.3.712486324.1670082223
_hjAbsoluteSessionInProgress 0
_hjid 0b87bac2-9702-4c0d-aa62-94bff45e0373
_hjIncludedInPageviewSample 1
_hjIncludedInSessionSample 0
_hjSession_125081 eyJpZCI6IjYzN2UyYjA5LWZiM2YtNDgyNi1hNzhhLTY2MTljNTY4ZDljMSIsImNyZWF0ZWQiOjE2NzAxNTE5OTU4MTMsImluU2FtcGxlIjpmYWxzZX0=
_hjSessionUser_125081 eyJpZCI6ImY3MjA5YzZhLTc2ZTQtNTA4Mi04MTUzLTA5ZmJlNTBlY2E1ZCIsImNyZWF0ZWQiOjE2NDI0NDI5ODEyMDksImV4aXN0aW5nIjp0cnVlfQ==
PHPSESSID e8ff25a726e36231df79b171695dfcf4
Body (form fields data)
feed[] code,name,model,desc,image,manu,category,barcode,colour,size1,size2,stock,brandprod,vat,commodityCode,countryOrigin Headers
documentLifecycle active
frameType outermost_frame
fromCache false
initiator https://www.chickenb2b.co.uk
ip 2606:4700:3035::6815:5c53
method POST
statusCode 200
statusLine HTTP/1.1 200
url Chicken Cycle-Kit B2B
alt-svc h3=“:443”; ma=86400, h3-29=“:443”; ma=86400
cache-control no-store, no-cache, must-revalidate
cf-cache-status DYNAMIC
cf-ray 77441ead6d7cf3eb-LHR
content-disposition attachment; filename=chickenfeed_04-12-2022.csv
content-type text/csv; charset=utf-8
date Sun, 04 Dec 2022 11:14:41 GMT
expires Thu, 19 Nov 1981 08:52:00 GMT
nel {“success_fraction”:0,“report_to”:“cf-nel”,“max_age”:604800}
pragma no-cache
report-to {“endpoints”:[{“url”:“https://a.nel.cloudflare.com/report/v3?s=pV2Gy%2FvGBMZZZbnFkiDH%2B%2Bhc4LV7Za3VC1WjNHVHQ3nl4YiGXt8WYoWU0Uk0FWAcIjwDHEy0RtBh6kKaB4B85luWmI1Vr4W72sjIKBbbDYTkMDekVWnDE%2FiLbYFm6ELOSkPKC2TcT1BLWbdShWsudkcYYQ%3D%3D”}],“group”:“cf-nel”,“max_age”:604800}
server cloudflare
vary Accept-Encoding,User-Agent

Hi @Luke_Austin, I am not familiar with this website, so I am not sure if you’re doing anything wrong here. Perhaps you can share some additional details? What exactly isn’t working in n8n for you?

Hi @MutedJam! I wouldn’t expect you to be familiar, it’s a bike parts distributor in the UK!

I’m trying to:

  1. log in, via their portal @ www
  2. when authenticated, kick off a bit of PHP that downloads the latest data feed for their products - Chicken Cycle-Kit B2B

If i can get those two to work, i’ll be saving the file in my local file system, for further processing.

At the moment, I can’t get the second HTTP node to accept the PHPSESSID cookie retrieved by the first, so i can;t kick off the php script with my POST request.

I can DM you my username / password to access the site, if required - for testing. As long as you promise not to order a million chains for me or something…