自动获取访问令牌

时间:2014-08-29 11:30:28

标签: javascript facebook facebook-graph-api

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

      (function(d, s, id){
         var js, fjs = d.getElementsByTagName(s)[0];
         if (d.getElementById(id)) {return;}
         js = d.createElement(s); js.id = id;
         js.src = "http://connect.facebook.net/en_US/all.js";
         fjs.parentNode.insertBefore(js, fjs);
       }(document, 'script', 'facebook-jssdk'));

        var fbd = function(){
            FB.api('/220753401365634/feed?access_token=', function(response){
                if (response && !response.error) {
                    console.log(response);
                }else{
                    console.log('error');
                    console.log(response);
                }
            });
        }

我试图从我的fb页面获取Feed。我从https://developers.facebook.com/tools/explorer/

获取访问令牌

它有效。但如果我从我的fb退出,在网页上我有错误:

code: 190
error_subcode: 467
message: "Error validating access token: The session is invalid because the user logged out."
type: "OAuthException"

如何以正确的方式获取访问令牌?

0 个答案:

没有答案