2012-12-19 71 views
0

我正在使用考拉宝石,并在我的用户界面我有一个共享链接。我如何使用帖子ID分享帖子。它可以这样做。我如何分享帖子使用帖子ID

@facebook = FacebookToken.first 
@graph = Koala::Facebook::API.new(@facebook.access_token) 
@graph.put_object(params[:post_id], "share",:message => "First!") 

它提供了以下错误

Koala::Facebook::ClientError: type: OAuthException, code: 240, message: (#240) Requires a valid user is specified (either via the session or via the API parameter for specifying the user. [HTTP 403] 

我的事情的东西许可走错了。我已经添加了以下权限的最喜欢的布尔应用

"share_item,manage_pages,publish_stream,read_stream,offline_access,create_event,read_insights, manage_notifications" 

我需要一些其他的许可使用帖子ID分享信息

+0

您是否需要Facebook-Graph-API或框架中的方法?是的,你需要使用'publish'方法,比如'POST/profile_ID/feed' – gaussblurinc

+0

@loldop所以我可以通过put_object方法来做到这一点。 – user1683039

+0

我使用'POST'代替。尝试使用'PUT' – gaussblurinc

回答

0

put_object第一个参数是不是帖子ID,但是谁共享它的ID,无论是页面还是用户。

所以不是说:

@graph.put_object(params[:post_id] ... 

你会说:

//the current user 
@graph.put_object('me' ... 

or 

//any user that you have a UID for 
@graph.put_object(@user.uid ... 

or 

//a page that you have post permissions for 
@graph.put_object(@facebook_page.id ... 

而且在考拉的未来版本,put_object会有点不同,你应该继续和切换到put_connection