I'm accessing a rest api. I have to do POST. The webservice is hosted behind the basic authentication. To access the given endpoint I have to also send an authorization header.
case 1: curl GET http://username:[email protected]/endpoint1 => works
case 2: curl GET http://@example.com/endpoint1 -H "Authorization: Basic base64_encode(username:password)" => works
case 3: curl POST http://@example.com/endpoint2 -H "Authorization: Basic base64_encode(username:password), Basic another_auth_token" => does not work
case 4: curl POST http://username:[email protected]/endpoint2 -H "Authorization: Basic another_auth_token" => does not work
Also tried using php curl curl_setopt($ch, CURLOPT_USERPWD, 'username:password') and it didn't work.
Tried adding headers, Content-Type: application/json and application/x-www-form-urlencoded and it didn't work.
I need curl POST with the two authorization headers to work.
Any pointers what could be missing?