1

我需要帮助才能在我的网站上永久创建一个 facebook 应用程序。访问令牌不断过期,我不知道如何获得永久令牌。我正在使用“ http://www.neosmart.de/social-media/facebook-wall/ ”中的 fb.wall

这是我的代码:

<script type="text/javascript">
        $(function () {
            $('#example1').fbWall({
                id: 'Facebookuser',
                accessToken: 'accesstokengoeshere',
                showGuestEntries: false,
                showComments: true, max: 5,
                timeConversion: 24
            });
        });
    </script>
4

1 回答 1

0

与其尝试获取永久访问令牌,不如尝试在每次有“accesstokengoeshere”时调用这样的函数:

function getAccessToken () {
    FB.getAuthResponse(function(response) {
      if (response.status == 'connected') {
        return response.authResponse.accessToken;
      } else if (response.status === 'not_authorized') {
      // if the user is not logged in to FB, prompt them to do so
      // later might want to change this so it doesn't automatically prompt you to login
      FB.login(function(response) {
        return getAccessToken();
      });
    } else {
      FB.login(function(response) {
        return getAccessToken();
      });
    }
  });
  }
于 2013-07-05T16:52:50.470 回答