在没有访问令牌的情况下访问公共图片? [英] Access public pictures without an access token?
问题描述
我为Drupal创建了一个php模块,该模块提取一个公共相册并在其中显示图片。我发现该模块突然停止工作。我用Google搜索,看起来即使是公开相册现在也需要访问令牌。我在 https://developers.facebook.com/上看到访问令牌字段tools / explorer /?method = GET& path = 10150146071791729
I created a php module for Drupal that pulls a public album and display pictures inside it. I discovered that the module suddenly stopped working. I googled and looks like even a public album requires an access token now. I see access token field on https://developers.facebook.com/tools/explorer/?method=GET&path=10150146071791729
在这种情况下,如何解决此问题?看来甚至offline_access都消失了。
In this case, how do I fix this problem? It looks like even offline_access is gone now.
我是否必须要求用户接受一定的许可?有什么许可?这是一张公共图片。
Do I must ask users to accept a certain permission? What permission? It's a public pictures.
推荐答案
好,找到答案了。
您需要创建一个应用程序并获取应用程序ID和密钥。
You need to create an app and get an app id and a secret key.
拥有这两个应用程序后,请在 https://github.com/facebook/facebook-php-sdk 。
Once you have those two, download Facebook PHP SDK on https://github.com/facebook/facebook-php-sdk.
示例代码:
require_once "facebook.php";
$facebook = new Facebook(array(
'appId' => 'appid',
'secret' => 'securet',
));
$token = $facebook->getAccessToken();
$json = file_get_contents("https://graph.facebook.com/293849234?access_token=".$token);
这篇关于在没有访问令牌的情况下访问公共图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!