I'm trying to use cURL to automate some processes that we usually do using a website.
I was able to login to the website using curl and the following command:
curl -k -v -i --user "[user]:[password]" -D cookiejar.txt https://link/to/home/page
However, when I'm trying to use the generated cookiejar.txt file for subsequent calls, I'm not getting passed the authorization.
The browser sends the following data to the server:
GET /[my other page] HTTP/1.1 Host [my host] User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-US,en;q=0.5 Accept-Encoding gzip, deflate Cookie JSESSIONID=[my session id] Authorization Basic [my encrypted string] Connection keep-alive
So, I changed my second cURL call to something like this, to be sure that all these parameters are sent as well:
curl -i -X GET -k -v \ -b cookiejar.txt \ -H "Authorization: Basic [my encrypted string]" \ -H "Host: [my host]" \ -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0" \ -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "Accept-Language: en-US,en;q=0.5" \ -H "Connection: Keep-Alive" \ https://[my other page]
Unfortunately this doesn't work. If I omit the Authorization header, I get a 401 error. If I include it in my cURL request, I get the Login page (with the 200 OK response).
There's no error in the console to give me at least a hint about what the problem is.
I appreciate any idea to help me get passed this issue.