我是Facebook API的新手,遇到了一个奇怪的问题,我真的找不到解决它的方法。我正在尝试使用以下说明获取访问令牌:
但当我试着去做的时候:
curl -X GET "https://graph.facebook.com/oauth/access_token?client_id=[ID]&client_secret=[SECRET]&redirect_uri=http://localhost&grant-type=clients_credentials"
即使我在代码中这样做,它也会失败:
var firstOptions = {
method: 'GET',
url: 'https://graph.facebook.com/oauth/access_token?client_id=[ID]&client_secret=[SECRET]&grant-type=client_credentials&redirect_uri=http://localhost',
json: true,
};
request(firstOptions, function (error, response, body) {
console.log(body);
});
所以我想知道是否有人能告诉我在哪里以及如何获得授权码?或者如果我做错了什么。因为facebook图片不包含任何授权码。
编辑:
在一个建议之后,我尝试了以下方法:
var pageOptions={
method: 'GET',
url: 'https://graph.facebook.com/[PAGE-ID]/posts?access_token=' + 'ID|SECRET',
json:true
};
但是我得到了以下错误:
{ message: '(#10) To use \'Page Public Content Access\', your use of this endpoint must be reviewed and approved by Facebook. To submit this \'Page Public Content Access\' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.',
当我使用由访问令牌调试器生成的访问令牌时,不会发生此错误:
https://developers.facebook.com/tools/debug/accesstoken/