通过 OpenGraph 发布到 Facebook 页面
通过所有文章和指南,我似乎无法弄清楚如何通过 Facebook 进行身份验证,以便我可以从我们的网站发布到我们的 Facebook 页面。您能给我一些“如何为傻瓜做到这一点”吗?最主要的是我不知道如何获取该 acces_token 。问题是:
- 我是否需要首先创建某种
facebook 应用程序
? - 应用程序是否会像页面管理员一样发布到页面墙上,或者作为应用程序,换句话说 - 作为页面管理员如何做到这一点?
through all the articles and guides, I can't seem to figure out how to authenticate with Facebook so that I could post from our website to our Facebook page. Can you please give me some sort of "how to do exactly this for dummies"? The main thing is that I can't figure out how to get that acces_token
. The questions are:
- do I need to create some sort of
facebook application
first? - will the app post to the page's wall as a page admin would, or as an application, in other words - how to do it as a page admin?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您必须创建一个 Facebook 应用程序才能让您网站的用户在 Facebook 上发布他们的内容。
使用 OAuth 2.0 的身份验证过程非常简单:
https://graph.facebook.com/oauth/authorizeclient_id=<您的应用的 client_id>&redirect_uri=<您的重定向 URU>
。正如您所看到的,您必须传输您的 client_id 和 Facebook 在流程结束时重定向的 URI。您还可以传输数据参数,该数据参数在整个过程中保持不变。对于跟踪用户很有用。https://graph.facebook.com/oauth/access_token?client_id=<您应用的 client_id>&redirect_uri=h<您的重定向 URU>&client_secret=<您应用的 client_secret>&code=
code 参数由上一步调用中的重定向 URI 给出
https://graph.facebook.com/me?access_token=
,使用先前重定向返回的临时 access_token,然后您将获得真正的 access_token。更多信息请参见:
http://developers.facebook.com/docs/authentication/
Yes, you have to create a Facebook application in order to let the users of your website post their stuff on Facebook.
The authenticate process, using OAuth 2.0, is quite simple:
https://graph.facebook.com/oauth/authorizeclient_id=<your app's client_id>&redirect_uri=<your redirect URU>
. As you can see, you have to transmit your client_id and an URI where Facebook will redirect at the end of the process. You can also transmit a data parameter, which will go unchanged through the process. Useful to keep track of the user.https://graph.facebook.com/oauth/access_token?client_id=<your app's client_id>&redirect_uri=h<your redirect URU>&client_secret=<your app's client_secret>&code=<code>
The code parameter is given by the call to the redirect URI on the previous stephttps://graph.facebook.com/me?access_token=<access_token>
, using the ad-hoc access_token returned by the previous redirect, and then you get the real access_token.More infos here:
http://developers.facebook.com/docs/authentication/
您需要找到您的用户 ID 和访问令牌
opengraph explorer
以下 Java 代码(使用 apache http 客户端),在指定用户 ID 的 facebook 墙上发布消息。
You need to find out your user id and an access token from
the opengraph explorer
The following Java code (using apache http client), publishes a message on the facebook wall of the user id specified.