nov / fb_graph

This gem doesn't support FB Graph API v2.0+. Please use fb_graph2 gem instead.
MIT License
1.04k stars 191 forks source link

Is there any way to post to wall of friends ? #219

Closed datnt closed 12 years ago

datnt commented 12 years ago

Hi , We are using fb_graph for our app and it is great.

Could you please explain that whether there is a function of gem fb_graph that allow current_user to post message to his/her friends's wall ?

Thank you very much, Dat

nov commented 12 years ago

If there is the function in Graph API documents, there should be in fb_graph.

ie.)

FbGraph::User#feed!(:key => "value")
# => POST /:user_id/feed?key=value
datnt commented 12 years ago

Thank you for your reply.

Could you please explain more specific about the solution.

datnt commented 12 years ago

I am able to post to multi-friends by using javascript function code as below:

function SendFBinvi(id){ FB.api('/'+id+'/feed', 'post', { message: 'my message', link:'http://localhost:3000', name:'title', picture:'', description:'my description }, function(response) { if (!response || response.error) { } else { } }); }

I'm expecting to do the same with RubyOnRails code by using fb_graph gem.

I had tried some method but for the same users (friends, which I can posted with javascript), fb_graph provide the following error:

FbGraph::Unauthorized (OAuthException :: (#200) The user hasn't authorized the application to perform this action)

nov commented 12 years ago

That error is saying your access token doesn't have publish_stream permission. https://developers.facebook.com/docs/authentication/permissions/

datnt commented 12 years ago

Thank you for your hint.

1> How can I configure so that my web-application able to gain publish_stream permission ? (I've read through the document of facebook but does not gain the idea of how to make the configuration)

2> Another thing came up; In this case, if my app does not have publish_steam permission, why the javascript of FB.api works ?

datnt commented 12 years ago

Hi Nov,

Could you please explain more from the 2 statements I provided above?

I don't understand about your suggestion of "publish_stream" configuration ?

Thank you, Dat