facebook:如何授予网站永久访问您的墙的权限?

发布于 2024-12-06 16:28:21 字数 1214 浏览 6 评论 0原文

我正在创建一个网站,我希望它能够显示我自己的 Facebook 个人资料页面墙上的帖子。这些帖子必须对访问我网站的任何用户可见。

在网上阅读了有关 Facebook api 主题的各种文章后,我以为我已经找到了正确的解决方案。以下步骤是我迄今为止所做的:

  1. 以开发人员身份登录 Facebook(帖子中最多只允许有 2 个 URL,因此我省略了该 URL)

  2. 设置一个新应用程序,该应用程序为我提供了应用程序 ID 和应用程序密钥。

  3. 在以下 URL 生成了我的访问令牌:

https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&scope=offline_access&client_id=APP_ID&client_secret=APP_SECRET

其中 APP_ID 和 APP_SECRET 是应用程序 ID 和应用程序密钥从步骤 2 开始。我还添加了“scope”参数并将其设置为“offline_access”,因为我相信这就是将允许我的网站访问我的 Facebook 墙信息,而无需我当前登录 Facebook。

当我在 [http://pauldailly.javaprovider.net/danceclass][1] 访问我的测试页面时(在步骤 2 中创建应用程序时,我将此 URL 设置为我的“站点 URL”。同样,我设置了我的“站点域名与我的网站 URL 相同,不含“/danceclass”)。我收到信息消息“Paul Dailly 尚未分享任何信息”,并且它显示我的 Facebook 个人资料图片。我应该指出,这个测试页面正在使用 Facebook Wall jQuery 插件来调用 facebook。我已经向插件提供了我的 Facebook 页面的个人资料 ID 和我上面生成的访问令牌。

我的问题是,既然我似乎拥有有效的访问令牌,我是否需要采取一些额外的步骤才能允许我的网站现在访问我的 Facebook 帐户中的特定数据,例如我的墙贴?

I am creating a website and I would like it to display the posts present on the wall of my own Facebook profile page. These posts must be visible to any user visiting my site.

Having read various articles online regarding the topic of the Facebook api, I had thought I had found the correct solution. The following steps are what I have done thus far:

  1. Signed in as a developer on Facebook (I am only allowed a max of 2 URLs in the post hence I have ommitted the URL)

  2. Set up a new app which gave me an App ID and an App Secret.

  3. Generated my access token at the following URL:

https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&scope=offline_access&client_id=APP_ID&client_secret=APP_SECRET

Where APP_ID and APP_SECRET are the App ID and App Secret from step 2. I also added the 'scope' parameter and set it to 'offline_access' as I believe this is what would allow my website to access my Facebook wall information without needing me to be currently logged into Facebook.

When I access my test page at [http://pauldailly.javaprovider.net/danceclass][1] (I set this URL to be my 'site URL' when creating my app in step 2. Similarly, I set my 'Site Domain' to be the same as my site URL, without the '/danceclass'). I get the information message 'Paul Dailly has not shared any information' and it displays my Facebook profile image. I should point out that this test page is using the Facebook Wall jQuery plugin to make the call to facebook. I have supplied the plugin my facebook page's profile ID and the access token that I generated above.

My question is, do I need to take some extra step in order to allow my site to now access specific pieces of data from my Facebook account, such as my wall posts, now that I appear to have a valid access token?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

英雄似剑 2024-12-13 16:28:22

首先,访问令牌可能会以多种方式过期,
1. 时间。
2. 当您退出时。
3.当您更改权限等时。

其次,是的,您需要来自用户的不同权限 (即使用户是应用程序管理员)从他的 Facebook 个人资料中检索不同的信息。

另外,请确保您在网站中正确构建元标记,例如放置 og:adminsog:app_id 等。您必须在启动 facebook 时提供 app_id ( php/js)-sdk 也在您的网站中。

First, a access token can expire in many ways,
1. Time.
2. When you log out.
3. When you change permission etc.

Second, yes you need different permissions from the user (even if the user is app admin) to retrieve different bit of information from his Facebook profile.

And also, make sure you construct meta tag currectly in your website, like putting og:admins, og:app_id etc. You have to supply the app_id when initiating the facebook (php/js)-sdk in your website too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文