1

I am trying to create a automation script in nodejs. My goal is to first login to the site and then download a particular file which you can only do that if you are autheticated that is logged in.

Is this possible without using selenium?, like only by using axios in nodejs. I tried using keepAlive in axios, but it is not working, 2nd axios request keeps redirecting to login page.

If not axios, is there anyother easy method?

Jatin Garg
  • 31
  • 5
  • If you are trying to crawl some site you need to set authentication for the second request, the way the website does it. It depends on the website, how they do auth, etc. Or the site may have APIs to do what you want – user1738539 Feb 23 '22 at 15:58
  • I can send post request from axios to authenticate. But after authentication if I make another request server sees request as unauthenticated – Jatin Garg Feb 23 '22 at 16:14
  • You will need to create a session that sets cookies https://stackoverflow.com/questions/49482429/axios-on-nodejs-wont-retain-session-on-requested-server-while-postman-does and probably some headers like `Authorization` – user1738539 Feb 23 '22 at 16:30

0 Answers0