Joshua Leung
Joshua Leung

Reputation: 2399

How to get instagram feeds from sandbox users?

I have invited other users to my client project's sandbox mode. But when I tried to get their feed through this link:

https://api.instagram.com/v1/users/" . $ig_user_id . "/media/recent/?access_token=" . $your_token

It responses with no data. But if $ig_user_id is set to 'self', I can get the data.

I am wondering if I need a different access_token for each sandbox user? Because I though the access token is valid per each client project.

Upvotes: 1

Views: 451

Answers (1)

user8556290
user8556290

Reputation:

You can use simple html with js ajax call, code example : requiremnt (jquery, api instagram token), have fun.

html file :

<div class="instagram" data-userid="1353830910" data-limit="12">
 img feed
</div>

<div class="igviewer hidden"><img src=""></div>

javascript file :

var ig = {};
// !!! USE YOUR OWN TOKEN

//https://www.instagram.com/{username}/?__a=1
ig.token = '1353830910.79a35d5.46da64c99de640ed927013d3532a14d1';

ig.init = function() {
  $('.instagram').each(function(i) {
     var args = {};
     args.container = $(this);
     args.userid = args.container.data('userid');
     args.limit = args.container.data('limit');
     args.feedurl = 'https://api.instagram.com/v1/users/'+args.userid+'/media/recent/?access_token='+ig.token+'&count='+args.limit+'&callback=?';
    args.html = '';
    // PASS ARGS TO QUERY
    ig.query(args);
  });
}
...

full example here : https://codepen.io/anon/pen/aLwKww

Upvotes: 1

Related Questions