-4

我使用Facebook的JavaScript SDK,並要啓用通用登錄。這意味着我讓我在我的網站,我可以訪問網站正常的帳戶。同時,我想這個登錄與Facebook自動登錄。對於這一點,我必須首先創建一個Facebook應用程序,並與我的Facebook帳戶verknüfpen這一點。我已經做到了。的JavaScript API自動Facebook的登錄爲來自HootSuite

但我怎麼能現在走的Facebook按鈕登錄登錄使用自動登錄我在Facebook普通用戶帳戶?

對於一些誰理解這個問題直接:zu Hootsuite

隨着來自HootSuite我可以創造一個正常的自由來自HootSuite帳戶(單獨的登錄如Facebook)。然後,我鏈接到我的Facebook帳戶,並與來自HootSuite Facebook應用程序,我的Facebook粉絲頁面。整件事發生一次。每當我現在來自HootSuite高於正常的帳戶登錄我自己直接輸送至Facebook等記錄,並可以訪問一切。

我知道整個事情是應該有什麼關係訪問令牌。不幸的是,我認爲互聯網只是沒有一個教程,我可以一個這樣的情況下進行編程。

我以前的代碼到目前爲止只有正常的Facebook憑據:我怎樣才能程序,自動Facebook登錄如來自HootSuite現在

<div id="fb-root"></div> 
<script> 
function checkLoginState() { 
    FB.getLoginStatus(function(response) { 
     statusChangeCallback(response); 
    }); 
    } 

    // This is called with the results from from FB.getLoginStatus(). 
    function statusChangeCallback(response) { 
    console.log('statusChangeCallback'); 
    console.log(response); 
    // The response object is returned with a status field that lets the 
    // app know the current login status of the person. 
    // Full docs on the response object can be found in the documentation 
    // for FB.getLoginStatus(). 
    if (response.status === 'connected') { 
     // Logged into your app and Facebook. 
     document.getElementById('status').innerHTML = 'Verbunden'; 
    } else if (response.status === 'not_authorized') { 
     // The person is logged into Facebook, but not your app. 
     document.getElementById('status').innerHTML = 'Please log ' + 
     'into this app.'; 
    } else { 
     // The person is not logged into Facebook, so we're not sure if 
     // they are logged into this app or not. 
     document.getElementById('status').innerHTML = 'Please log ' + 
     'into Facebook.'; 
    } 
    } 

    window.fbAsyncInit = function() { 
    FB.init({ 
     appId  : 'AppID', 
     xfbml  : true, 
     status  : true, 
     cookie  : true, 
     version : 'v2.1' 
    }); 

    FB.getLoginStatus(function(response) { 
    statusChangeCallback(response); 
    }); 

    }; 

    (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/de_DE/sdk.js"; 
    fjs.parentNode.insertBefore(js, fjs); 
    }(document, 'script', 'facebook-jssdk')); 
</script> 

+1

對不起,這是一個英文網站。我不知道在這一點上,這樣一個本地化的德語版本,但有一個葡萄牙語。 – mskfisher 2014-10-31 17:10:32

回答

0

旁註:你shoulderstand翻譯你的問題,計算器僅僅是英語。


的應用程序登錄(並沒有什麼來自HootSuite使用)意味着你必須首先登錄到Facebook的 - 因此,有沒有別的星期四如果您使用Facebook登錄上來自HootSuite,你需要先登錄到Facebook。

不要太擔心的訪問令牌時,JavaScript SDK一般需要關心,除非你想要做更復雜的東西像生成擴展的訪問令牌和諸如此類的東西。

登錄是非常容易使用JavaScript SDK:https://developers.facebook.com/docs/reference/javascript/FB.login/v2.2

只要確保你打電話做了用戶交互(鼠標點擊)功能 - 否則它可能會被阻塞在瀏覽器中。