1

我正在尝试代表应用程序在用户墙上发帖。

这就是我正在做的事情。

首先,我从 facebook connect 获取用户 access_token,然后extended access token使用以下调用接收

https://graph.facebook.com/oauth/access_token?             
  client_id=APP_ID&
  client_secret=APP_SECRET&
  grant_type=fb_exchange_token&
  fb_exchange_token=EXISTING_ACCESS_TOKEN 

现在,当我尝试使用以下代码在朋友墙上发帖时。

        var params = {};
        params['message'] = 'Check out this new gag I\'ve posted about you surely it will piss you off :p';
        params['name'] = 'Gagsterz';
        params['description'] = 'If you also want to have fun on gagster join in now.';
        params['link'] = 'http://localhost/php/backup/View/Profile.php';
        params['picture'] = thumbpath;
        params['caption'] = 'Caption';


        FB.api('/'+victimid+'/feed?access_token="ACCESS_TOKEN", 'post', params, function(response) {
          if (!response || response.error) {
             var json = $.parseJSON(response.error);
             alert(json.code);
        alert(JSON.stringify(response.error));
          } else {
            alert('Published to stream - you might want to delete it now!');
          }
        });

它给出了以下错误。

 the target user has not authorized this action facebook graph api
 with code 200.

我获得了publish_stream权限,我通过恢复权限然后登录再次授予权限来测试它,登录窗口要求获得post on behalf权限。但是我在第一次检索访问令牌时获得了权限. 我是否必须再次获得扩展访问令牌的许可?如果是,那么该怎么做?

4

1 回答 1

1

检查您的权限,您是否有权在墙上发帖。默认情况下,您将只有读取权限。

检查这个http://developers.facebook.com/docs/reference/rest/stream.publish/

于 2012-12-03T14:07:18.547 回答