How to check the application id is valid or not in facebook using graph api?
I am adding application to my fan page.I came to know that for adding application to fan page ,you should be admin means 开发者_如何学JAVAonly admin of that page can add.I am asking application id to user(who can use).Whatever application that user know that can get added.But suppose user add something fake data.Then how to handle that?How can I check with facebook domain?
To clarify what I think your question is; You are trying to make an app that will have an option to 'add to my page'? So the user will select a page which they administrate, and your app will add itself to that page? So you want to be able to verify that the page ID they enter is a real page, and that they have administrator priviledges for said page?
The best way I think would be to only give them a few options in the first place. You can use something like this:
FB.login(function (response){
FB.api('/me/accounts',function(apiresponse){
var data=apiresponse['data'];
var ids = new Array();
for(var i=0; i<data.length; i++){
ids[i]=data[i].id;
}
console.log(ids);
});
},{scope:'manage_pages'});
That will give you a list of the page IDs that the user is able to administrate. Then just put those in a select box for them to choose from.
精彩评论