So I'm trying to understand the Instagram API and I'm a bit lost.
I have a site where I will be displaying one image from my Instagram and will have a LIKE button.
From what I can gather all I need is my Client ID and then I can send a post request via AJAX to like the photo on Instagram. But first I need to authenticate the user first? This is where I'm stumped. Is there a tutorial that can walk me through this? So when the user clicks on LIKE it pops up a window to authenticate them and then it likes the photo.
I would suggest reading the Instagram API documentation and also take a look at the Instagram Javascript SDK they have on Github: https://github.com/Instagram/instagram-javascript-sdk
Alternatively, there is another Instagram JS SDK you could use, written by Bryantchan - https://github.com/bryantchan/Instagram-JS-SDK
An example from Bryan's SDK on authentication is 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 will go to the authorize page
//handle the fn token
var token = IG.getToken();
//you need to set token before you use it
IG.setOptions( {
token: token
} );
//or without using token
IG.setOptions({
client_id: your_client_id
})
//you code...