In my React app, I'm making a GET
REST web service call to an endpoint whose purpose is to generate a presigned AWS URL to a protected S3 asset. We pass an Authorization
header and a token to the service.
This initial call works as expected and the service responds with a redirect (via a 307 response code) and includes the presigned URL in the response's Location
header.
The issue I'm facing is that when the redirect is followed, Amazon rejects the call with a 400 response code and the following message.
Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified.
Is there a way to remove the Authorization
header before the redirect is followed?
This seems like it should be a fairly common situation (when a React application requires access to a protected S3 asset) - is there a better way to handle this use case?