[英]Get Public Photos from Facebook Page without Requesting Access Token
I'm looking over this Facebook API documentation and it can't be true that in order to read in a page's public photos, you need to ask the user for permission to connect with THEIR Facebook account? 我正在查看此Facebook API文档,但要想读入页面的公开照片,您是否需要请求用户许可才能连接到其Facebook帐户,这是不正确的?
Something like this fails. 这样的事情失败了。
/* make the API call */
FB.api(
"/{album-id}",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Error says: 错误提示:
"An access token is required to request this resource."
So then now I can't find a way (that isn't out of date) to have an API call get an access token without prompting the visitor to accept anything. 因此,现在我无法找到一种方法(并非过时)来使API调用获得访问令牌,而不提示访问者接受任何东西。
What am I overlooking? 我在俯视什么?
Update: this works. 更新:这有效。 And I know not to store the app secret on the client side. 而且我知道不要在客户端存储应用程序密码。
FB.api(
'/{album-id}',
'GET',
{'access_token':'{app-id}|{app-secret}'},
function(response) {
/* handle the result */
}
);
If the Page is not restricted by age or location, you can use an App Access Token (App-ID|App-Secret). 如果页面不受年龄或位置的限制,则可以使用应用程序访问令牌 (App-ID | App-Secret)。 If the Page is restricted, you can authorize a Page Admin with the manage_pages
permission and request an Extended Page Token - it is valid forever, as the App Access Token. 如果页面受到限制,则可以授予manage_pages
权限的页面管理员,并请求扩展页面令牌 -它永远有效,作为App Access令牌。
More information about Tokens: 有关令牌的更多信息:
Important: You should not use those Tokens on the client, the are always meant to be kept secret. 重要提示:您不应该在客户端上使用这些令牌,因为它们总是要保密的。 You should use the Token on the server and implement some caching, or you will hit API limits if you get a lot users/hits. 您应该在服务器上使用令牌并实现一些缓存,否则如果用户/点击量很大,则会达到API限制。
如果它是“公共”照片/相册,则可以使用应用程序访问令牌 ( <APP_ID>|<APP_SECRET>
可以用作应用程序访问令牌,但是您切勿在客户端公开应用程序的机密,就像密码一样对您的应用程序)进行查询。
\GET /<api>?access_token=<APP-ACCESS-TOKEN>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.