ログインはできますが、友達を取得accessToken
するなどの他の API を呼び出せるように、 を取得する必要があります。
メソッドが呼び出されますが、応答時getLoginStatus
にブロックに入りません。success
これが私のコードです:
$(document).ready(function() {
window.fbAsyncInit = function() {
FB.init({
appId: <<My appId>>, // App ID
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse XFBML
oauth: true
});
FB.getLoginStatus(function(response){
alert('response='+response);
});
window.setTimeout(checkLogStatus, 1000);
function checkLogStatus(){
alert("check");
// fetch the status on load
FB.getLoginStatus(function(response){
alert('response='+response);
});
}
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
});