I am trying to fetch a pdf document from API using ColdFusion and I receive this error:
<?xml version="1.0" encoding="UTF-8"?> InvalidArgument Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specifiedAuthorization #key# Some requestid some host id` 400 Bad Request
Welcome to the forum. I think this is a simple issue - although Companies House could help with a bit more documentation here! Hopefully the following will help:
Most likely this is because you’re still sending the Companies House http basic authentication header to Amazon. You need to send this header with each request up to this point, but when you make the last request for the amazonaws url you shouldn’t. This is because:
Amazon don’t use it (don’t send your “passwords” to others) - the documentation could be clearer here.
Amazon do have an authorisation mechanism but it is done using the query string parameters (on the end of the url). If you also send an http authorisation header it will confuse Amazon.
Or to put it another way: Amazon require authentication but all their authentication is done via the contents of the “final_url”. So the authentication is passed as parameters in the query string. So if you also include the http headers for authorisation from Companies House (the “Authorization = decoded_auth” ), this will confuse the Amazon servers.
For further information please see my answers on the following threads (including a full error message you can check against what you received to confirm that this is indeed the problem).