curl with cookie authentication

How to download files from sites requiring authentication

Have you ever logged into a website that requires you login before you can download a file? Subsequently, a simple ‘copy-link’ option does not allow you to wget the file and a HTTP 403 Authorization Failed message is thrown. In order to get around this, I’ve used this method when a cookie for authentication is used:

  1. If not installed, download and install Chrome
  2. Download and install cookie.txt export from the Chrome Web Store
  3. Using Chrome, login to the site where you’re attempting to wget or curl a file for download.
  4. Click on the cookie.txt export button next to the address bar in Chrome, and copy the contents into a file, such as cookies.txt
  5. ~# curl -L -b cookies.txt -o name.iso
    1. -L follow redirects; -b use the cookie in specified file; -o write ouput to this local file

Comments are welcome on alternative ways using other web browsers.