curl: request is missing authentication header - authentication header there
curl: request is missing authentication header - authentication header there
to Add more context: I am trying to make a curl request to the Seamless.gov API. On a different computer the same curl command works. However, when I run the curl command on my machine it doesn't work.
curl -X GET -H "Content-Type: application/json" -H "Date: 1530285602" -H "Authorization: HMAC-SHA256 api_key=XXXXXXXX nonce=12335 signature=XXXXXXXXXXXXX" -d 'false' https://nycopp.seamlessdocs.com/api/form/CO1708XXXXXXXXXXXXX/elements
I have the following version of curl
:
curl
curl: stable 7.60.0 (bottled), HEAD [keg-only] Get a file from an HTTP, HTTPS or FTP server https://curl.haxx.se/ /usr/local/Cellar/curl/7.60.0 (423 files, 3MB) Poured from bottle on 2018-06-29 at 11:44:32 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/curl.rb
==> Dependencies Build: pkg-config ✔ Optional: openssl ✘, rtmpdump ✘, libssh2 ✘, c-ares ✘, libmetalink ✘, nghttp2 ✘
==> Options
--with-c-ares Build with C-Ares async DNS support
--with-gssapi Build with GSSAPI/Kerberos authentication support.
--with-libmetalink Build with libmetalink support.
--with-libssh2 Build with scp and sftp support
--with-nghttp2 Build with HTTP/2 support (requires OpenSSL)
--with-openssl Build with OpenSSL instead of Secure Transport
--with-rtmpdump Build with RTMP support
--HEAD Install HEAD version
==> Caveats This formula is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble.
If you need to have this software first in your PATH run: echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/curl/lib
CPPFLAGS: -I/usr/local/opt/curl/include For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig
Same curl
command works on another machine but not on mines, could it be an issue with the version or the operating system. I'm running on Mac OS High Sierra
curl
{
"error": true,
"error_log": [
{
"error_code": "missing_header",
"error_message": "Request is missing header: `Authorization`",
"error_description": "{"Host":"XXXX.seamlessdocs.com","Connection":"close","X-Real-IP":"161.185.7.10","X-Forwarded-For":"161.185.7.10","X-Forwarded-Host":"nycopp.seamlessdocs.com","X-Forwarded-Port":"443","X-Forwarded-Proto":"https","X-Original-URI":"/api/form/CO1XXXXXXXXXXXXXXX/elements","X-Scheme":"https","Content-Length":"5","user-agent":"curl/7.54.0","accept":"*/*","content-type":"application/json","date":"1530285602","authorization":"HMAC-SHA256 api_key=XXXXXXXXXXXXXXX nonce=12335 signature=XXXXXXXXXXXXXX"}"
},
{
@mbuechmann done
– Steven Aguilar
Jun 29 at 17:59
1 Answer
1
There is one hint in the error message:
==> Caveats This formula is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble.
OS X already has curl installed and this binary is used. This version does not work with your request. To find out where homebrew has installed curl execute:
ll /usr/local/opt/curl
You will get an output like that:
lrwxr-xr-x 1 maltebuchmann admin 21B Jun 30 09:50 /usr/local/opt/curl -> ../Cellar/curl/7.60.0
With that info you can execute your above command:
/usr/local/Cellar/curl/7.60.0/bin/curl -X GET -H "Content-Type: application/json" -H "Date: 1530285602" -H "Authorization: HMAC-SHA256 api_key=XXXXXXXX nonce=12335 signature=XXXXXXXXXXXXX" -d 'false' https://nycopp.seamlessdocs.com/api/form/CO1708XXXXXXXXXXXXX/elements
You can follow the printed instructions to add the installation folder to your path:
If you need to have this software first in your PATH run: echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.bash_profile
Or, you can forcefully link it with homebrew:
brew link curl --force
But do this at your own risk :)
can I delete the
curl
version installed thru brew and just have the one already installed with OS X?– Steven Aguilar
21 hours ago
curl
OS X's curl version is causing the problems. The homebrew version fixes it and is just not accessible by default. The steps above fixes the accessibility.
– mbuechmann
21 hours ago
So it works if I make the curl command using the steps above but what if I would like to set curl to default the version install via brew? I mean so I don't have to run
usr/local/Cellar/curl/7.60.0/bin/curl
everytime and just use curl
– Steven Aguilar
17 hours ago
usr/local/Cellar/curl/7.60.0/bin/curl
curl
You can either add the path
/usr/local/opt/curl/bin
to your $PATH variable (see above) or try to link it with the --force
option (see above). Former approach is recommended.– mbuechmann
16 hours ago
/usr/local/opt/curl/bin
--force
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Please enter the shell output as text, not as a screenshot.
– mbuechmann
Jun 29 at 17:52