javascript - Instagram : Liking a photo on an external site -
so i'm trying understand instagram api , i'm bit lost.
i have site displaying 1 image instagram , have button.
from can gather need client id , can send post request via ajax photo on instagram. first need authenticate user first? i'm stumped. there tutorial can walk me through this? when user clicks on pops window authenticate them , likes photo.
i suggest reading instagram api documentation , take @ instagram javascript sdk have on github: https://github.com/instagram/instagram-javascript-sdk
alternatively, there instagram js sdk use, written bryantchan - https://github.com/bryantchan/instagram-js-sdk
an example bryan's sdk on authentication below:
var ig = new instagram(); var param = { client_id : your_client_id, redirect_uri : your_redirect_uri, scope : your_scope, response_type: 'token' } ig.auth( param ); //then go authorize page //handle fn token var token = ig.gettoken(); //you need set token before use ig.setoptions( { token: token } ); //or without using token ig.setoptions({ client_id: your_client_id }) //you code...
Comments
Post a Comment