如何使用显示专辑的PHP构建Facebook应用程序? [英] How to build a Facebook app with PHP that shows albums?
问题描述
我想建立一个使用图形API来显示特定用户相册的Facebook网络应用程序。该用户总是一样的,我知道他的凭据。
我的代码到目前为止:
$ this-> facebook-> api(username / albums?access_token =。$ this-> access_token);
但是我得到以下异常:
[error] =>数组
(
[message] =>需要用户访问令牌来请求此资源
[type] => OAuthException
[code] => 102
)
我需要生成一个 acces_token
永远生活,并能够检索这个信息,因为现在我只能访问公共数据。我必须从哪里开始?
当您有注册的应用程序时,您可以生成始终有效的应用访问令牌。
使用此URL获取您的访问令牌:
https: //graph.facebook.com/oauth/access_token?
client_id = YOUR_APP_ID
& client_secret = YOUR_APP_SECRET
& grant_type = client_credentials
您可以在应用程序页面上找到应用程序ID和应用程序秘密。
请注意,您看到的相册和/或照片取决于相册/照片/
I want to build a Facebook web application that uses the graph API to show only the albums of a specific user. That user is always the same, and I know his credentials.
My code so far:
$this->facebook->api("username/albums?access_token=" . $this->access_token);
But I get the following exception:
[error] => Array
(
[message] => A user access token is required to request this resource.
[type] => OAuthException
[code] => 102
)
I need to generate an acces_token
that lives forever and is able to retrieve this information, because right now I can only access public data. Where do I have to start?
When you have a registered app you can generate an app access token which is always valid.
Use this URL to get your access token:
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID
&client_secret=YOUR_APP_SECRET
&grant_type=client_credentials
You can find the App id and App secret on your apps page.
Please note that the albums and/or photos you see depend on the privacy settings of the albums/photo/
这篇关于如何使用显示专辑的PHP构建Facebook应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!