Can't list images/video [ReactJs]
Hello
I come here because I have a problem with Cloudniary. I use ReactJS and when I upload an image / video everything goes well but when I want to list my uploads via resources / or list / I have the following error: 'No' Access-Control-Allow-Origin 'header is present on the requested resource. Origin 'http: // localhost: 3000' is therefore not allowed access. The response had HTTP status code 401. '
When I type search my data directly via the URL I have the JSON that appears.
I also install the REACT SDK but still nothing.
Thanks
-
Hi Sooonr,
Can you please share with us your code and the method you're using to list the images? In general, the list resources method is specific to our backend SDK frameworks and is currently not available in the React SDK.
Thanks
0 -
Hi Raya,
That's the code I use to get my list :
axios.get('https://api.cloudinary.com/v1_1/sooonr/resources/image/upload?max_results=500&prefix=test/user').then(res => {
console.log(res.data.ressources);this.setState({gallery:res.data.resources});});Thanks0 -
Hi Sooonr,
Using resources is not available client side since it means exposing your API secret. That being said, you can use list to list all videos with a specific tag.
For example,
http://res.cloudinary.com/<cloud_name>/video/list/<tag_name>.json
You could take a look at this tutorial for more information and pointers- https://github.com/cloudinary-developers/build-a-mini-netflix/blob/master/React/display-videos.md
0 -
Hi,
I have already try this turorial but I still have an error 401.
I even tried with the tag on an image but still not working.
0 -
Hi Sooonr,
Please open a ticket at support@cloudinary.com with more details on your implementation.
0
Post is closed for comments.
Comments
5 comments