English 中文(简体)
FB JS-SDK无法直接检测出FB的用户伐木。
原标题:FB JS-SDK cannot detect user logging out of FB directly

TL;DR Facebook javascript SDK cannot determine the accurate login status of a user who has directly logged out from facebook.com underneath it.

I m 利用javascript SDK进行认证。 我已注意到,当用户日直接从Facebook(面读书.com)上抽出时,SDK不能对用户的标识表示感觉。 我ve倒了以下简单测试案例。

Log in to facebook.com in one tab. In another tab, render the app page below (replacing MY_APP_ID as appropriate). If you are logged into facebook as a user that has never given permissions to this app, click "Login" and grant them. Either way, you should see some events fire indicating you are logged in.

Now, back on the facebook.com tab, log out of facebook. Go to the app tab and click all the buttons (except "Login") and look at the browser console output.

问题在于,在这种情形下,似乎无法合法地确定从SDK的用户标识状况。 或者,我做一些事情,尽管我把它推倒到最低限度。

我在此的最终目标是,如果用户在已经从脸书上砍伐后点击我的原木,我就能够做,<<>~em>。 但是,SDK没有实现这一目标的可行手段。

Any ideas or thoughts? Has anyone else experienced this and found a workaround? Thanks!

简单一页:

<html lang= en  xml:lang= en  xmlns= http://www.w3.org/1999/xhtml  xmlns:fb= http://www.facebook.com/2008/fbml >
<head>
</head>
<body>
<script>
  window.fbAsyncInit = function() {
    function subFBEvent(name) {
      FB.Event.subscribe(name, function(r) {
        console.log(name);
        console.log(r);
      });
    }
    subFBEvent( auth.login );
    subFBEvent( auth.logout );
    subFBEvent( auth.authResponseChange );
    subFBEvent( auth.statusChange );
    FB.init({
      appId  :  MY_APP_ID ,
      status : true, // check login status
      cookie : true, // enable cookies to allow the server to access the session
      xfbml  : true,  // parse XFBML
      oauth  : true       // use OAuth 2.0
    });
  };
  (function() {
    var s = document.createElement( div ); 
    s.setAttribute( id , fb-root ); 
    document.documentElement.getElementsByTagName("body")[0].appendChild(s);
    var e = document.createElement( script );
    e.src =  http://connect.facebook.net/en_US/all.js ;
    e.async = true;
    s.appendChild(e);
  }());
</script>
<button onclick="FB.logout(function(r) { console.log( FB.logout ); console.log(r); });">Logout</button>
<button onclick="FB.getLoginStatus(function(r) { console.log( FB.getLoginStatus ); console.log(r); });">LoginStatus</button>
<button onclick="FB.getAuthResponse(function(r) { console.log( FB.getAuthResponse ); console.log(r); });">AuthResponse</button>
<fb:login-button>Login</fb:login-button>
</body>
问题回答

First of all: why exactly do you want to do this?

“Facebooklogin”基本上只是“Facebook”用户的方便,以避免在你的网页上填上标志或标志。 它便于在你自己的网站上设立用户会议,但只要我知道,这并不赋予你在Facebook上直接登录用户的任何权利(也不允许像Sackover流程这样的任何其他FacebookLogin-ened网站)。 这还有助于另一轮工作:如果在Facebook上出现用户记录,并不意味着他应当失去通过FacebookLogin建立的所有其它会议。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.