Reputation: 101
So I am trying to upload an image to S3 from my React Native code but I am getting a 403 error? I have amplify and have connected it to a user that has admin permissions but it is still not working.
import Amplify from 'aws-amplify';
import { Storage } from 'aws-amplify';
Storage.put('test.txt', 'Hello')
.then (result => console.log(result))
.catch(err => console.log(err));
And the error that I am getting is:
Upvotes: 1
Views: 490
Reputation: 7193
Have a try by adding the contentType at the time of uploading the file.
Storage.put('test.txt', 'Private Content', {
level: 'private',
contentType: 'text/plain'
})
.then (result => console.log(result))
.catch(err => console.log(err));
Upvotes: 1