nandanself
nandanself

Reputation: 835

Getting the CORS error while getting calling the Instagram api

I have ember app which show Instagram images.I am making the request to Instagram api to user information like profile pic and username but I am getting the error

Error

XMLHttpRequest cannot load https://api.instagram.com/v1/users/self/?access_token=25634653241563.63765274276357. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.example.co.in' is therefore not allowed access.

In the Instagram Manage client I have filled the website as "http://example.co.in"

The Request

raw({
        url:"https://api.instagram.com/v1/users/self/?access_token=25634653241563.63765274276357",
        crossDomain: true,
      }).then(function(response){
      console.log(response)
})

Upvotes: 0

Views: 988

Answers (1)

Ember Freak
Ember Freak

Reputation: 12872

Before calling ajax request you can configure ajax setup settings to allow cross domain origin request..

Ember.$.ajaxSetup({ xhrFields: { withCredentials: true }, crossDomain: true }); This will take care of the appending cookie settings to each request.

Upvotes: 1

Related Questions