1
我很成功地獲取「userID」和「訪問令牌」,但無法獲取我的目標頁面上的名稱和其他基本詳細信息。 我怎樣才能得到這個? 這是我的代碼。從Facebook訪問我的網站的基本信息的步驟?
<div id="fb-root">
</div>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
FB.init({ appId: '225565837521406', status: true, cookie: true, xfbml: true, oauth: true });
// FB.login({ scope: 'name,email,user_birthday'});
FB.getLoginStatus(function(response) {
if (response.status === 'connected')
{
var theSession=response.session;
var theSession = eval('(' + theSession + ')');
var name=response.name;
var name=eval('(' + name + ')');
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
var email=response.authResponse.email;
// alert("Name: " +name+ " UserID: " +uid+ " Access Token: " +accessToken);
document.getElementById("fb-root").innerHTML="Name: " +name+ "<br />UserID: " +uid+ "<br />Access Token: " +accessToken+ "<br />Email: " +email+ "<br />Session: " +theSession;
}
else if (response.status === 'not_authorized')
{
alert("Not Authorized..");
}
else
{
alert("nothing..");
}
});
</script>