I'm trying to upload a video to an S3 Signed url generated from Brightcove. The code I have works in Android but not on the iPhone, where it returns:
<?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>ACCESS_KEY</AWSAccessKeyId><StringToSign>PUTvideo/mp41595593499/ingestion-upload-production/6156229735001/6174315892001/d7885428-be54-483d-8033-b2ae1c6f2ccc/influencer-2.mp4</StringToSign><SignatureProvided>Xm1W67u+mpFF5cIZZZ1Zgf8SD0U=</SignatureProvided><StringToSignBytes>50 55 54 0a 0a 76 69 64 65 6f 2f 6d 70 34 0a 31 35 39 35 35 39 33 34 39 39 0a 2f 69 6e 67 65 73 74 69 6f 6e 2d 75 70 6c 6f 61 64 2d 70 72 6f 64 75 63 74 69 6f 6e 2f 36 31 35 36 32 32 39 37 33 35 30 30 31 2f 36 31 37 34 33 31 35 38 39 32 30 30 31 2f 64 37 38 38 35 34 32 38 2d 62 65 35 34 2d 34 38 33 64 2d 38 30 33 33 2d 62 32 61 65 31 63 36 66 32 63 63 63 2f 69 6e 66 6c 75 65 6e 63 65 72 2d 32 2e 6d 70 34</StringToSignBytes><RequestId>34038BC3772C8E20</RequestId><HostId>VgjsNXg9r8gGLvhF5Pwa+2d9D61BTTMZtu/SsUKwzkdz2RZORN69AQp7isqQ3un7Z9h105Lz5vU=</HostId></Error>
This is my code:
const preSignedURL ='XXXX'; let imagePATH = p.node.image.uri; if (Platform.OS === 'ios') { const photoPATH = convertLocalIdentifierToAssetLibrary( p.node.image.uri,'MP4', ); const dest = `${RNFS.TemporaryDirectoryPath}influencer-2.mp4`; imagePATH = await RNFS.copyAssetsVideoIOS( photoPATH, dest, ); } const headers = { 'Content-Type': 'video/mp4' }; imagePATH = imagePATH.replace('file://', ''); RNFetchBlob.fetch('PUT', preSignedURL, headers, RNFetchBlob.wrap(imagePATH), ) .then((res) => { const { status } = res.info(); console.log(res.info()); console.log(res.text()); console.log(res.base64()); if (status === 200) { console.log(res.text()); } else { // handle other status codes } }) // Something went wrong: .catch((errorMessage, statusCode) => { console.log(errorMessage); });}}
I've tried also using xhr or fetch, but I always get the same error. I understand that the issue might be to a different headers or something else, but this works perfectly in Android