2012-12-03 76 views
1

我試圖代表應用程序在用戶牆上張貼。目標用戶未授權此操作facebook圖表api

這是我正在做的。

首先我得從Facebook用戶連接的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 

現在,當我嘗試張貼在牆上的朋友用下面的代碼reciever的extended 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 permission.But我服用了許可,而我測試了它首次檢索訪問令牌。我是否必須再次獲得擴展訪問令牌的許可?如果是的話那麼該怎麼做?

回答

1

檢查您的權限,您是否有權在牆上發佈信息。默認情況下,您將只擁有讀取權限。

入住這http://developers.facebook.com/docs/reference/rest/stream.publish/

+0

我把權限'publish_stream',我已經通過恢復權限,然後登錄到授予權限,以它again.But這是我在許可而我檢索訪問測試它令牌第一次。我是否必須再次獲得擴展訪問令牌的許可? – Mj1992

相關問題