我正试图把facebook上的帖子转到我的网站上。我为同样的(https://www.facebook.com/kcm.edu.np/)创建了一个facebook应用程序。代码:
$(document).ready(function() {
var accessToken ='975498622499311|eKS53jkWW4F74JEShrDHuJNwOwg';
$.ajax({
url: 'https://graph.facebook.com/v2.5/kcm.edu.np/posts?fields=full_picture,id,is_published,link,story,message,name,updated_time,description,from,source,caption,created_time,permalink_url,type,target&access_token=' + accessToken + '&limit=6',
type: 'GET',
success:function(result){
$("#hidden-next-feed").val(result.paging.next);
$.each( result.data, function( index, value ) {
var link;
var imgSrc = '';
var name = '';
var message = '';
if(typeof(value.link) != "undefined" && value.link !== null) {
link = value.link;
} else {
link = value.permalink_url;
}
if(typeof(value.full_picture) != "undefined" && value.full_picture !== null) {
imgSrc = value.full_picture;
}
if(typeof(value.name) != "undefined" && value.name !== null) {
name = value.name;
}
if(typeof(value.message) != "undefined" && value.message !== null) {
message = value.message;
}
$("#facebook-feed").append(
'<div class="grid-item"><a href="'+value.permalink_url+'" target="_blank">'+
'<div class="thumbnail">'+
'<img src="'+imgSrc+'" alt="'+name+'" >'+
'<div class="caption">'+
'<h3>'+name+'</h3>'+
'<p>'+message+'</p>'+
'</div>'+
'</div>'+
'</a></div>'
);
});
$container.masonry('destroy');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: '.grid-item',
percentPosition: true
});
});
},
error:function() {
$("#facebook-feed").html('Failed To Load Resource');
}
});
});问题:
{
"error": {
"message": "Unsupported get request. Object with ID 'kcm.edu.np' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"fbtrace_id": "FsBLqadb5Oz"
}
}我该怎么解决这个问题?欢迎任何帮助/建议。提前谢谢。
发布于 2016-05-25 03:51:04
页面可见性的设置需要设置为“每个人都可见”。此选项可在“设置”>“一般”>“国家限制”下找到.
请尝尝这个。
发布于 2016-05-25 09:08:29
App Secret,而应该使用PHP并向服务器发出ajax请求。正如@WizKid所说,应用程序密匙应始终视为您的密码
-如果不这样做,你的帐户和应用程序可能会被破坏。尽快复位。
/<id>/feed?fields=<fields>在您的例子中,页面的id是: 1451944358387272。
https://stackoverflow.com/questions/37427243
复制相似问题