XMLHttpRequest cannot load https://api.instagram.com/v1/users


#1

I’m trying to hit an Instagram endpoint from my route…

let https://api.instagram.com/v1/users...
return Ember.$.getJSON(url).then((data) => {
            return data;
        });

When I hit this route, i get the following error:

XMLHttpRequest cannot load https://api.instagram.com/v1/users/self/followed-by?access_token=xyz. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.

I’ve looked this up on multiple searches and I tried using: Ember.$.ajaxSetup but I can’t seem to get around this. Can someone lend a hand?

Failed Attempts:

http://stackoverflow.com/questions/32149239/setting-headers-in-the-model-hook-via-ajaxsetup-ember

http://stackoverflow.com/questions/29947123/how-to-enable-cors-in-an-emberjs-application

http://stackoverflow.com/questions/35668350/getting-the-cors-error-while-getting-calling-the-instagram-api


#2

Figured it out, adding &callback=? to the end of my URL did it for me. Ugh, 4hrs spent figuring that out!!