好扎卡里,您对Facebook的连接有点误解。当用户点击放置在您网站上的Facebook连接按钮时,Facebook不会访问您的数据库来验证用户身份。他在他的数据库中验证用户是否当前用户有Facebook帐户...如果他/她有帐户,那么Facebook通过将他登录到Facebook来为该特定用户颁发访问令牌。那么现在您有责任在系统中登录该用户,并将他的信息放入您的数据库。让我进一步解释并看看下面的代码
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: "Your APP ID",
status: true,
cookie: true,
xfbml: true});
FB.getLoginStatus(function(response) {
if (response.session) {
// This is the place where you get control when user is login to facebook
// At this point you can redirect the user to a page where you can put the facebook returned information to database and login him into your system
} else {
}
});
FB.Event.subscribe("auth.login", function(response) {
window.location.reload();
});
FB.Event.subscribe("auth.logout", function(response) {
self.location.href="http://www.iranibash.com/logout.php";
});
};
(function() {
var e = document.createElement("script");
e.src = document.location.protocol + "//connect.facebook.net/en_US/all.js";
e.async = true;
document.getElementById("fb-root").appendChild(e);
}());
</script>
现在您可以使用Facebook成功登录后返回您的用户信息。您可以在$ cookie中获得该信息。我认为你可以从这些信息中了解吗?