Blocked by CORS in localhost

Avatar image for elchiconube
#1 Edited by elchiconube (6 posts) -

Hi guys I'm trying to create a little app with VueJS and I want to use this API. For this purpose I'm using axios library but I'm having problems: This is the function:

axios.get(',name') .then(function(response){ console.log(response); }) .catch(function(error){ console.log(error); }) 

And I have this error in the console:

XMLHttpRequest cannot load '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.

Thanks guys!

Avatar image for elchiconube
#3 Posted by elchiconube (6 posts) -

@monkehhh:Hi, thanks for the reply, I try to understand these two threads and change the url to this:,name  Any idea?
Avatar image for elchiconube
#4 Posted by elchiconube (6 posts) -

Hi again,

I see that axios doesn't suport jsonp and now I'm trying with this:

jsonp('', function(err, data){

if (err) {

return console.error(err.message);

} else {

return console.log(data);



Then I have this error in the console: Uncaught SyntaxError: Unexpected token ?

Thanks for your help!

Avatar image for elchiconube
#5 Posted by elchiconube (6 posts) -

Ok I fix it! I try with other plugin called mithril:


url: ",image,platforms,description,original_release_date",

callbackKey: "json_callback",


.then(function(response) {



thanks for your patience

Avatar image for rallax
#6 Posted by rallax (1 posts) -

Wow, this thread is old, but I am having the exact same issues with CORS.

I can enter the url with my API key into chrome and see the JSON, I can enter it into postman and get the response as well, but when I am trying use axios or fetch the url, I get the error.

I am currently in a coding bootcamp and I was going to use the API to make a backlog app for my solo project that is due this coming Friday. I will continue to work on other aspects of the site, but unless I can get access to the API, I have nothing :(

Avatar image for eddyb
#7 Edited by eddyb (1 posts) -

@rallax: This is how I've been structuring my requests with jQuery:

url: _url,
dataType: "jsonp",
jsonp: 'json_callback',
data: {
api_key: 'api_key',
format: 'jsonp',
success: function(res) {

I'd prefer to be using fetch and promises, but I haven't managed to get it configured yet. Let me know if you have any luck!