且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

创建Facebook访问令牌而无需登录

更新时间:2023-02-24 11:40:02

即使是公开帖子,也必须授权用户才能获得访问权限.使用 read_stream 获取所有帖子,或者使用 user_status 获取仅该用户的帖子.

Even for public posts, you have to authorize the user in order to get access. Either with read_stream to get ALL posts or with user_status to get the posts of the user only.

read_stream很可能不会被Facebook批准,请参阅此文档: https://developers.facebook.com/docs/facebook-login/permissions/v2.2

read_stream will most likely not get approved by Facebook though, see this document: https://developers.facebook.com/docs/facebook-login/permissions/v2.2

请记住,公开"并不意味着您无需用户授权即可获取它.应用程序不能只是刮取他们想要的内容-仍然不允许刮取: https://www.facebook.com/apps/site_scraping_tos_terms.php

Keep in mind that "public" does not mean you can grab it without user authorization. Apps can´t just scrape what they want - scraping is not allowed anyway: https://www.facebook.com/apps/site_scraping_tos_terms.php

此外,当然,如果没有用户交互(登录和授权),就无法创建用户令牌(这是您所需要的).可以在以下链接中找到有关访问令牌的详细信息:

Also, of course you can´t create a User Token (which is what you need) without user interaction (login and authorization). Detailed information about Access Tokens can be found in the following links:

顺便说一句,文档提到查看公共链接需要任何有效的访问令牌".-因此,您可能只能获得链接.

Btw, the docs mention that "Any valid access token is required to view public links." - So you may be able to get links only.

来源: https://developers.facebook.com/docs/graph-api/reference/v2.2/user/feed

要调试访问令牌,请使用Facebook调试器: https://developers.facebook.com/tools/debug/

For debugging Access Tokens, use the Facebook Debugger: https://developers.facebook.com/tools/debug/

我刚刚意识到您只是想获取Facebook页面的公共供稿,而不是用户个人资料.为此,您可以只使用一个应用程序访问令牌.它永远不会过期并且易于创建: App-ID | App-Secret .查看文档以获取更多信息.请记住,如果页面受到年龄或国家/地区的限制,则需要使用用户令牌或页面令牌.

I just realized that you just want to grab the public feed of a Facebook Page, not a User Profile. For that, you can just use an App Access Token. It´s never expiring and easy to create: App-ID|App-Secret. Check out the docs for more information. Keep in mind that you would need to use a User Token or Page Token if the Page is restricted by age or country.