Facebookオブジェクトからコメントを取得し、JavaScriptを使用してページに投稿することになっているページがありますが、ユーザーがログインすると、OAuthトークンを取得する方法を一生理解できません。これが私のページです。
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function () {
FB.init({
appId: 'myrealappid',
status: true,
cookie: true,
xfbml: true,
oauth: true,
});
};
(function (d) {
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
function getComments(objectid) {
//I need to append the OAuth token to this graph request
var commentUri = "https://graph.facebook.com/" + objectid + "/comments";
return $.getJSON(commentUri, function (json) {
var html = "<ul>";
$.each(json.data, function (i, fb) {
html += "<li>" + fb.message + "</li>";
});
html += "</ul>"
});
$('.comments').html(html);
};
$(document).ready(function () {
getTripComments(data.WallPostId);
});
</script>
<div id="pageLogo">
<img src="/images/page_logo.png" alt="Digital Mementos" />
</div>
<div id="container">
<div class="fb-login-button">Login with Facebook to Comment</div>
<div id="comments">
</div>
</div>
「このグラフリクエストにOAuthトークンを追加する必要があります」と表示されている場所を確認してください。ええ、私はそれをする必要があります。OAuthトークンを取得するにはどうすればよいですか?それとも私はこれについてすべて間違っていますか?