AWS S3 signed url encoding, resulting in "SignatureDoesNotMatch"

I am using cordova file transfer to download a file from aws s3 using a signed URL, because cordova filetransfer encodes uri, the "%" in the signature is converted to "% 25", thus leading to a signature mismatch

+4
source share
1 answer

Try setting the following options:

options = {
            fileKey: 'file',
            fileName: name,
            chunkedMode: false,
            mimeType: 'audio/3gpp',
            httpMethod: 'PUT',
            // Important!
            headers: {
                'Content-Type': 'audio/3gpp' // < Set explicitly otherwise it becomes multipart/form-data which won't work with S3
            },
            encodeURI: false // < Stops any extra encoding by file transfer logic
        }

Took a lot of painful hours, getting pre-signed PUT working with cordova / S3. Good luck.

+7
source

All Articles