2011-12-22 46 views
1

搞錯了新的訪問令牌,我從我的帳戶,這當然禁用訪問令牌中刪除我的應用程序。我一直在關注Facebook身份驗證文檔頁面中的步驟以獲取新的訪問令牌,並最終取得了成功,但無濟於事;訪問令牌,實際上我生成的幾個令牌不起作用。如何獲取Facebook應用

有人可以提供一些指導?

回答

0

如果您使用的JavaScript SDK - 這是你的最佳路徑:

<div id="fb-root"> 
</div> 
<script type="text/javascript"> 
    (function() { 
     var e = document.createElement('script'); e.async = true; 
     e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; 
     document.getElementById('fb-root').appendChild(e); 
    }()); 

    window.fbAsyncInit = function() { 
     FB.init({ appId: 'YOUR_APP_ID', 
      status: true, 
      cookie: true, 
      xfbml: true, 
      oauth: true 
     }); 

     FB.getLoginStatus(function (response) { 
      if (response.status === 'connected') { 
       var uid = response.authResponse.userID; 
       //you access token is right below 
       var accessToken = response.authResponse.accessToken; 
       console.log('connected and allowed'); 
      } else if (response.status === 'not_authorized') { 
       console.log('connected but not allowed'); 
       top.location.href = "https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_RETURN_URL&scope=user_photos,publish_actions"; 
      } else { 
       // the user isn't even logged in to Facebook. 
       top.location.href = "https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_RETURN_URL&scope=user_photos,publish_actions"; 
      } 
     }); 
    }; 


</script> 
相關問題