-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

只要确保你打电话做了用户交互(鼠标点击)功能 - 否则它可能会被阻塞在浏览器中。