2012-10-23 58 views
-1

我用js sdk用facebook登錄我的網站。如果用戶第一次訪問我的網站並嘗試登錄,它就可以正常工作。如果用戶登錄到Facebook並轉到我的網站,它也可以正常工作。但是,如果用戶從Facebook和我的網站註銷並點擊登錄按鈕後進入我的網站,他會看到彈出窗口並輸入他們的電子郵件並通過Facebook。點擊登錄後,顯示空白彈出窗口this url帶查詢權限的空白窗口

我不明白爲什麼它要求許可,如果Facebook知道這個用戶被授權爲我的網站。

這裏是我的代碼

<html> 
<head> 
    <meta charset="utf-8"> 
</head> 
<body> 
    <div id="fb-root"></div> 
    <script type="text/javascript"> 
     window.fbAsyncInit = function() { 
      FB.init({ appId: 189221317879406, status: true, cookie: true, xfbml: true, oauth:true }); 
     }; 
     (function() { 
      var e = document.createElement('script'); 
      e.type = 'text/javascript'; 
      e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; 
      e.async = true; 
      document.getElementById('fb-root').appendChild(e); 
     }()); 
     function loginWithFacebook(){ 
      FB.login(function(response) { 
       if (response.authResponse) { 
        //FB.api('/me', function(response) {alert(response.name);}); 
        window.location.href='http://mysite.com/home/'; 
       } 
      }, 
      {scope: 'user_photos,friends_photos,user_birthday,friends_birthday,user_education_history,friends_education_history,user_location,friends_location,user_relationships,friends_relationships,user_work_history,friends_work_history'}); 
     } 
    </script> 
    <a href="#" onclick="loginWithFacebook()"> 
      <img src="/files/images/facebook-login-button.png" style="width: 90px; height: 90px;"></a> 
</body> 

+0

將參數show_error = 1添加到您提到的URL會帶來良好的舊API *錯誤代碼:191 - API錯誤描述:指定的URL不屬於應用程序「* - 請自己研究如何解決這個問題,因爲它已經被一遍又一遍地討論過了。 – CBroe

回答