2011-12-22 32 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> 
相关问题