'Amazon AWS S3 'Invalid Argument--Unsupported Authorization Type' When Trying to Post a file to our bucket

I'm new to web dev and this is a bit of a head scratcher. We have a part of our software that uploads documents to an Amazon cloud through a Rest api from our server-side code.

I'm new to the company, but this part of the system seems like it's been around for a while, and only recently started acting up in the past two months. Can't seem to find any recent code changes that would affect it, though perhaps I just haven't looked hard enough.

The api goes to make a post request to the S3 service, and gets back an 'InvalidArgument' error, with the message 'Unsupported Authorization Type.'

The Authorization header looks like this: "Bearer [TokenID]".

If I take out the Authorization header, as I've read elsewhere, I get back this error: 'MethodNotAllowed', 'The specified method is not allowed against this resource.'

The particular bucket CORS settings look like this:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

Any help is greatly appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source