Error while posting to feed: “The user hasn't authorized the application to perform this action”

感情迁移 提交于 2019-12-08 11:26:29

问题


I'm getting error while posting a feed on my facebook from url:

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

I'm using

https://graph.facebook.com/me/feed?name=hello&message=hello_from_url&access_token=access_token

as my URL. I'm creating a rails app for which I need scope parameter so that I can post on my timeline from rails app but I'm unable to find out the exact solution.


回答1:


First thing is that adding scope parameter to this posting URL is useless, permissions are set on first use of app depending on the permissions definded in the scope on auth dialog.

Your application needs publish_actions permission to post feed. And if you add this permission to config you have to authenticate to your app again to accept new permissions.

Use Graph API Explorer to check if everything is fine with this. Select your application from dropdown in the top right corner, change method to POST and paste me/feed?name=hello&message=hello_from_url. Then run it and check if you have this exception or not. Click Get Access Token to check permissions you granted your app.

And BTW, you can use fb_graph to post feed, if you're not using it:

me = FbGraph::User.me(access_token)
 me.feed!(
    :message => '',
    :link => '',
    :name => '',
    :description => ''
  )


来源:https://stackoverflow.com/questions/14684434/error-while-posting-to-feed-the-user-hasnt-authorized-the-application-to-perf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!