0

I would like to download a file from the following link (direct download link) :

https://download.spaces.hightail.com/api/v1/download/sp-79272721-ef49-4de4-a239-01f5be0692a7?downloadFile=true&redirectOnError=%2Freceive%2FSxnIY0QbDr

In browser when I hit the above url, it gives me the following error : "Credentials are required to access this resource."

To overcome this, first I access the base url (given below) in the browser and then from another tab hit the direct link. This allow me to download the file without credential required error. https://spaces.hightail.com/receive/SxnIY0QbDr <--- Base url

I would like to download the same file with curl using direct download link. However I get the same 'credential required' error.

  1. How can I download the file using curl from direct download link and avoid "credential required" error ?
  2. Why do I need to access the base url first before accessing the download link in the browser ?

May be base url share some authentication information with the browser and the same is used by browser later, but I don't have clear understanding.

Thanks !!!

user2679476
  • 365
  • 3
  • 12
  • Some useful link is here : https://stackoverflow.com/questions/3044315/how-to-set-the-authorization-header-using-curl – user2679476 Apr 17 '21 at 06:30

1 Answers1

0

The way I solved this issue is :

  • Get the request headers details (raw data) from browser developer tool when downloading the file using browser and store them in a local file. It also contains cookie which is used for authentication.

  • Get the certificate (.pem) file. Since I am using some proxy server, I got it from the proxy server admin console.

  • Execute the following curl command :

    curl -v -S -x proxy_ip:proxy_port -H "$(cat raw_header)" --cacert cert.pem -o ./myfile https://download.spaces.hightail.com/api/v1/download/sp-79272721-ef49-4de4-a239-01f5be0692a7

user2679476
  • 365
  • 3
  • 12