2011-12-22 9 views
1

誤って、アクセストークンを無効にしたアカウントから自分のアプリケーションを削除しました。私は新しいアクセストークンを得るためにFacebookのAuthentication Docページからのステップに従ってきましたが、最終的には成功しましたが役に立たなかった。実際に私が生成したいくつかのトークンは動作しません。Facebook Appの新しいアクセストークンを取得する方法

誰かが方向を教えてくれますか?

答えて

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> 
関連する問題