有没有一种方法可以在不要求用户登录的情况下将 Facebook 内容(特别是来自公共页面的墙贴)显示在网站上?在离线访问权限被弃用之前,我会简单地创建一个令牌作为我自己,存储它,并根据需要提取信息.
Is there a way to pull Facebook content (specifically wall posts from a public page) to display on a website without Facebook requiring a user login? Before the offline_access permission was deprecated, I would simply create a token as myself, store it, and pull the information as needed.
现在,据我所知,我只有两个选择:1) 每 60 天手动更新一次该令牌,或 2) 仅向 Facebook 用户显示内容并使他们允许"应用程序.显然#1 不是首选选项,#2 似乎不是很好的做法.
Now, from what I can figure out, the only two options I have are to 1) manually update that token every 60 days, or 2) display the content only to Facebook users AND make them "allow" the app. Obviously #1 is not a preferred option, and #2 doesn't seem like very good practice.
作为参考,我只是尝试从可公开访问的页面墙中提取内容,不需要代表用户执行任何操作(无墙发帖、无阅读流等).
For reference, I'm only trying to pull content from a publically accessible page wall and require no action on behalf of the user (no wall posting, no reading stream, etc).
这似乎是一个非常简单的概念,我觉得我必须遗漏一些东西.我在任何地方都找不到答案.这些真的是我唯一的两个选择吗?任何反馈将不胜感激.
This seems like a really simple concept, and I feel like I have to be missing something. I can't find an answer anywhere. Are these really my only two options? Any feedback would be much appreciate.
更新:
我想我可能已经找到了解决这个问题的方法.随着 offline_access 被弃用,有一个 fb_exchange_token 选项可用于延长现有令牌的到期时间.拨打以下电话:
I think I may have found a way around this. With offline_access being deprecated, there is an fb_exchange_token option available to extend the expiration of an existing token. With a call to the following:
https://graph.facebook.com/oauth/access_token?client_id={app_id}&client_secret=
{app_secret}&grant_type=fb_exchange_token&fb_exchange_token={existing_token}
您应该会收到一个过期时间延长的令牌.在我的场景中,我将允许应用通过我自己的 Facebook 帐户,将令牌存储在我的 PHP 代码中,并仅使用 cURL 定期更新现有代码.
you should receive a token with an extended expiration. In my scenario, I will allow the app through my own Facebook account, store the token in my PHP code, and just use cURL to periodically update the existing code.
注意:根据 Facebook 文档,到期时间每天只能延长一次
假设您拥有该页面,您可以使用 manage_pages 权限.manage_pages 权限是我可以收集的永久令牌.然后在graph api上使用/feed和相关页码拉取信息.
Assuming you own the page you can use the manage_pages permission. The manage_pages permission is a permanent token from what I can gather. Then use /feed on the graph api with the relevant page number to pull the information.
我假设您拥有此页面.如果您没有或未获得明确许可,则您无权删除此信息.
I am assuming you own this page. If you don't or aren't explicitly given permission then you don't have the rights to pull this information down.
这篇关于向非 Facebook 用户显示 Facebook 帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!