Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload image to imgur failed because of cors

I'm trying to upload an image to imgur with js (browser) and get a CORS error:

Access to XMLHttpRequest at 'https://api.imgur.com/3/upload' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

But preflight request contains Access-Control-Allow-Origin header: enter image description here

The request itself:
enter image description here

What I'm missing? this is because access-control-allow-credentials set to true?

like image 739
Michael Avatar asked Apr 17 '19 17:04

Michael


1 Answers

The problem was with their API Docs :\ The URL is: https://api.imgur.com/3/image and not https://api.imgur.com/3/upload as said here: https://apidocs.imgur.com/#c85c9dfc-7487-4de2-9ecd-66f727cf3139

like image 129
Michael Avatar answered Oct 23 '22 16:10

Michael