程序地登录到Facebook并从服务器端发帖 [英] Programatically log in to facebook and post from server side

查看:99
本文介绍了程序地登录到Facebook并从服务器端发帖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的Web应用程序与Facebook业务页面连接起来。每次我在页面上添加一个新产品,我想把它发布在Facebook墙上。我有一个Facebook应用程序和页面所有者的用户名和密码。我可以自动与用户进行身份验证,传递给Facebook并从服务器端发送发送请求吗?通常当我添加产品时,我已经使用另一个Facebook帐户登录。另外我想在另一个页面用户添加产品时发布。

I want to connect my web application with the facebook business page. Each time I add a new product to the page I want to post it on facebook wall. I have a facebook application and the page owner username and password. Can I automatically authenticate with the user, pass to facebook and send the post request from server side only? Usually I am logged in with another facebook account when I add products. Also I would like to post when another page user add a product.

推荐答案

您可以使用manage_pages权限发布到Facebook作为Facebook页面。您需要从作为页面管理员的用户获取此权限。这个过程有几个步骤,这里是一个基本的总结:

You can post to Facebook as a facebook page using the manage_pages permission. You'd need to obtain this permission from a user who is an administrator of the page. There are a few steps to the process, here is a basic summary:

  • Get an access token from a user who is an administrator of the page and has granted "manage_pages" to your app. read about authentication here: http://developers.facebook.com/docs/authentication/
  • using that access token, make a graph request to

https://graph.facebook.com/me/accounts?access_token=USER_AUTH_TOKEN

您将收到包含用户管理的所有页面的json响应,其中包含其名称,类别,Facebook ID和验证令牌 - 这是您需要发布的内容

You'll get a json response containing all the pages the user administrates, containing their name, category, facebook id, and an auth token - this is what you'll need to post to that page

然后您可以使用此访问令牌使用

you can then use this access token to post to the specific page using

https://graph.facebook.com/PAGE_ID/feed?message = POST_MESSAGE& access_token = AUTH_TOKEN& method = post

我刚刚发现这个博文给你一个很好的解释
http://developers.facebook.com/blog/post/465/

I just found this blog post which gives you a pretty good explanation http://developers.facebook.com/blog/post/465/

这篇关于程序地登录到Facebook并从服务器端发帖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆