【问题标题】:How to programmatically publish to a facebook feed for a liked webpage?如何以编程方式将喜欢的网页发布到 Facebook 提要?
【发布时间】:2012-05-02 18:14:03
【问题描述】:

我正在努力让它工作:https://developers.facebook.com/blog/post/465/

第 1 步:我正在获取访问令牌:

https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=myAppIdclient_secret=myAppSecret

第 2 步:我通过 curl 发帖

curl -F 'access_token=myAccessToken'  -F 'message=Hello World!'  -F 'id=http://example.com'  https://graph.facebook.com/feed

myUrl 在哪里说http://example.com

我收到此错误,无法解析为有效的用户 ID:

{"error":{"message":"(#100) http:\/\/example does not resolve to a valid user ID","type":"OAuthException","code":100}}

第 3 步:如果我首先将我的 url 发布到 linter,并获取它的 ID:

https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fexample.com

https://graph.facebook.com/10150096126766188

curl -F 'access_token=myAccessToken'  -F 'message=Hello World!'  -F 'id=10150096126766188'  https://graph.facebook.com/feed

然后我收到“用户尚未授权应用程序执行此操作”错误:

{"error":{"message":"(#200) The user hasn't authorized the application to perform this action","type":"OAuthException","code":200}}

【问题讨论】:

  • 我已经在我的两个网站上运行了这个,但现在我再次被困在试图让它在一个新网站上运行:(

标签: facebook facebook-graph-api


【解决方案1】:

来自Facebook Graph API docs

Most write operations require extended permissions[1] for the active user.
See the authentication guide[2] for details on how you can request extended
permissions from the user during the authentication step.

1 https://developers.facebook.com/docs/authentication/permissions

2https://developers.facebook.com/docs/authentication/

【讨论】:

  • 嘿弗雷泽。我错过了什么吗?这里没有活跃用户。
  • 我希望 Stackoverflow 能够加入 21 世纪并通知人们答案和 cmets :)
  • 我假设您在上面的示例中故意遗漏了您的访问令牌?
  • 是的。如果你愿意,我可以私下分享。
【解决方案2】:

按照博客文章,这是通过应用程序完成的,为此,应用程序需要扩展权限“publish_actions”和“publish_stream”才能发布帖子/cmets/likes/links

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-03-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多