1
我正試圖讓Facebook登錄在我的網站上工作。我運行下面的代碼:Facebook SDK獲取權限
window.fbAsyncInit = function() {
FB.init({
appId : '1340103676056632',
xfbml : true,
version : 'v2.8'
});
FB.AppEvents.logPageView();
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function myFacebookLogin() {
FB.login(function(){
FB.api('/me','GET',{"fields":"email,birthday,gender,hometown,location"}, {scope:'user_location,email,user_birthday'},
function(response) {
console.log(response);
}
);
})
}
我得到的的console.log以下回應:
對象 ID : 「1223808051065376」 名 : 「凱文Tinnemans「
雖然根據圖形API瀏覽器,我應該得到以下輸出。
{
"email": "[email protected]",
"birthday": "01/01/1900",
"gender": "male",
"hometown": {
"id": "123456789",
"name": "Narnia"
},
"location": {
"id": "123456789",
"name": "secret, secret, Netherlands"
},
"id": "123456789"
}
謝謝!這個伎倆 –