0

There are two levels of authentication in my API

  • Basic auth for the API domain (API hosted website is secured through a basic auth)
  • Basic auth for the specific API call.

I used the following call and domain level basic auth is working. But API call level basic auth isn't working.

curl https://example.com/test.json -u "abc:abcd1234" // domain level authentication

-k -H 'Authorization: Basic erwf234werwrefdsf234245wewrwer==' // API call level authentication

-d 'data={}'

1 Answers1

0

I do not believe you can it if both services require the same header for authorization.

Both methods (-u and -H) end up putting the information in the same header field (more detail is provided here: cUrls's option "-u" )

Additionally, here is a discussion about the use of multiple headers with the same name, as well as the option for some headers (but not Authorization) to accept multiple values as a list:

Multiple authentication schemes for HTTP 'Authorization' Header