0

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.

4

1 回答 1

1

我建议阅读Instagram API 文档并查看他们在 Github 上的 Instagram Javascript SDK:https ://github.com/Instagram/instagram-javascript-sdk

或者,您可以使用另一个 Instagram JS SDK,由 Bryantchan 编写 - https://github.com/bryantchan/Instagram-JS-SDK

下面是 Bryan 的 SDK 中关于身份验证的示例:

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...
于 2013-05-09T19:26:14.443 回答