Capture my own number of followers

Asked

Viewed 165 times

0

I’m trying to get a get of my follower number via Instagram API.

I already own my clientId, mine userid and my accessToken. With the use of instafeed.js I can already access the feed. But whenever I try to get a get to any url:

https://api.instagram.com/v1/users/self/?access_token=[MY_ACCESS_TOKEN]
https://www.instagram.com/[MY_PROFILE]/?__a=1
https://www.instagram.com/web/search/topsearch/?query=[MY_QUERY]

I fall into the problem of Same Origin Policy:

No 'Access-Control-Allow-Origin' header is present on the requested Resource. Origin 'http://localhost:5000' is therefore not allowed access.

I already set up the headers:

app.use(function(req, res, next) {
    res.header('Access-Control-Allow-Origin', "*");
    res.header('Access-Control-Allow-Methods','GET,PUT,POST,DELETE');
    res.header('Access-Control-Allow-Headers', 'Content-Type');
    next();
})

And I’ve tried using the cors.

Does anyone know any way?

From now on, thank you.

1 answer

0


I was able to solve the problem by making the request via server using the module request with NPM, instead of doing by ajax. So no error.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.