我正在嘗試將Facebook登錄按鈕併入我的網站主頁。我已經將它與一個應用程序連接起來,所以我有應用程序ID和祕密,但我無法弄清楚如何檢查用戶是否已經註冊到我的網站,所以在我的數據庫中,以便預覽他的用戶配置文件。我已經使用從Facebook的javaScript sdk,但當我按Facebook的登錄按鈕,授權後,沒有任何反應,我的網站的主頁再次顯示。有誰知道如何從javascript sdk獲取用戶的電子郵件?我正在爲我的頁面使用Java servlet。我使用了facebook文檔中的代碼。使用Facebook登錄登錄我的網站
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '8568345835', // App ID
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
};
// 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));
</script>
<div class="fb-login-button" data-scope="email">
謝謝你的回答。我搜索了通過Facebook文檔,但我仍然困惑的JavaScript,我應該包括哪些方法....關於重定向,我必須把重新鏈接的地方?對不起,如果這些聽起來很愚蠢的問題,但我完全是新的這個... – 2012-03-07 18:50:08