Reputation: 21
I've been searching through the web for an answer but was unable to find something ... so I'm trying here. Sorry if the question has already been solved, it would mean I need to fix my search skills !
The idea of my application: a list of item with images that can be browsed by everyone. An admin part allows an authenticated user to create the items (and upload the image).
For this, what I did for the setup:
amplify init
amplify add auth
amplify add storage
amplify add api
Most of the config are the ones by default. Only for the storage, I configured:
Now, in my React application, when I do this:
Storage.put(image.name, image, { level: 'public' })
I get
Failed to load resource: the server responded with a status of 403 (Forbidden)
The only way I can make this work is by adding the permission of create on the unauthenticated role. But that's not the goal !
I'm sure I'm missing something but I was not able to find what ...
Thanks for the help !
Upvotes: 1
Views: 1257
Reputation: 21
Ok, found the problem. The user I used for login was still with a challenge to change the generated password --> not considered as authenticated.
Once the password has been changed, upload can be done !
Upvotes: 1