I have Instagram login in my ember app.I am using Server-side (Explicit) Flow.I am making an ajax request to Instagram for user authentization for app.But I am receiving an error "Allow-origin-access-control" (cors).
My request
var CLIENT_ID = "hasdgfasdfghsdfghsadgafsdgf";
var CALLBACK_URL = "http://ift.tt/1Uodu5l";
var AUTH_BASE = "http://ift.tt/1hv1BmR";
var AUTH_URL = AUTH_BASE + "?client_id=" + CLIENT_ID + "&redirect_uri=" + CALLBACK_URL + "&response_type=code";
raw({
url:AUTH_URL,
crossDomain: true,
}).then(function(response){
console.log(response)
});
In the Instagram manage app.I have given the website's URL as http://example.com and redirect uri same as above.If I open the AUTH_URL (request url ) in another tab it works fine and gives access_token.But when I make the same request through my app it throws an error.
error
XMLHttpRequest cannot load http://ift.tt/1Uodu5n…http://ift.tt/1Q7viPh. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com' is therefore not allowed access.
Did you check to make sure you have an "Access Control Allow Origin: http://ift.tt/1hv1BmR" header on the file at CALLBACK_URL that handles the redirected response? Try with "Access Control Allow Origin: *" while testing.
RépondreSupprimer