Error 403 in request via $ .ajax to instagram

0

Does anyone know why this ajax request from error 403 and the URL works normally?

The instagram has changed their api and I found this code that serves as a pagination in the media, when I make the request via ajax it of error (403 - forbidden) and when I make the request via browser url it works normally. >

Can anyone help me?

$.ajax({
    url: 'https://www.instagram.com/graphql/query/?query_hash=472f257a40c653c64c666ce877d59d2b&variables={"id":"3937127813","first":12,"after":"AQDiT0FqVoPQ_0vSPXYUwAIBPCvt8Iw3KpsqYvixKzVDAstuZkHRyAMHo3NgnI2q1ygiLq-5PJ0TCe8daBbEy1RgkIVhY4aECXdwSZnwyWtpbQ"}',
    method: "GET",
    dataType: 'json',

    success: function (retorno) {
        console.log(retorno);
    }
  });
    
asked by anonymous 11.04.2018 / 18:54

1 answer

0

Start chrome like this:

chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security

It will not solve the problem of users accessing your site, this only solves the problem of your own browser, but the script will not work for other people due to #

CORS , for security you will not be able to access directly.

Instagram API is deprecated and will be discontinued

First of all, according to the link page the API you are using is deprecated and will probably not be functional any more soon, probably on 11, December 2018.

The API you should use now is link

Using the new Instagram API

"Unfortunately" you do not just pick up and quit using you have to first follow the steps outlined in:

And your app is probably going to have to undergo an evaluation before being functional, by the facebook team itself.

I think what you will need is this: link to bring the content, however I'll let you know, via Ajax it will not be possible to use it, you will have to use it with some server-side language that does the HTTP request directly in the facebook API, for example PHP, asp.net, Django (python), etc. >     

12.04.2018 / 20:49