Error 403 on request via UI.ajax to instagram

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

Instagram changed their api and I found this code that serves as a paging in the media, when I make the request via ajax it da error (403-prohibited) and when I make the request via browser url 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);
    }
  });
Author: Joao, 2018-04-11

1 answers

Start chrome like this:

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

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 the corns, that is, for security you will not be able to access directly.

Instagram API is deprecated and will be discontinued

First of all as per page https://www.instagram.com/developer / to API that is using it is obsolete and will probably soon no longer be functional, probably on 11, December 2018.

The API you should use now is https://developers.facebook.com/products/instagram /

Using the new Instagram API

"Unfortunately" is not just pick up and leave using have to first follow the steps described in:

And probably your app you will have to go through an evaluation before becoming functional, by your own Facebook team.

I think what you're going to need is this: https://developers.facebook.com/docs/instagram-api/insights to bring the contents, however I leave you warned, via Ajax will not be possible to use, will have to use with some server-side language that makes the HTTP request directly in the Facebook API, for example PHP, asp.net, Django (python), etc.

 0
Author: Guilherme Nascimento, 2018-04-12 18:49:01