Upload image to imgur failed because of cors

前提是你 提交于 2019-11-28 11:02:15

问题


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:

The request itself:

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


回答1:


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



来源:https://stackoverflow.com/questions/55733271/upload-image-to-imgur-failed-because-of-cors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!