I am attempting to use the Graph API Explorer to create an access token for my application to view my pages using \'me/accounts\'. However, every time I try this, it returns me
I had a similar issue. Several solutions on stackoverflow mostly attributed the issue to the lack of required permissions. Check the permissions you need by using the Graph API explorer or documentation (The tables have a column called permissions for each field). Some suggestions have been to use the scope to specifically mention which permissions you need in the login button or while making the call to the api. Eg:
FB.login(function (response) {
if (response.authResponse) {
console.log('Welcome! Fetching your information.... ');
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, { scope: 'email,publish_stream,user_birthday,user_location' });
I had a different issue where I had double-checked all the permissions set for my app dashboard that were correct, but while logging in, I had specified a scope with a set of permissions which seemed to override the app settings. :( I found this strange, but I rectified it by including the other permissions in the scope too and my problem was resolved.
An effective way to see if the right permissions are being set through the code is to use the following code:
FB.api({ method: 'fql.query', query: 'SELECT user_status,friends_status,user_photos,friends_photos,user_location,friends_location FROM permissions WHERE uid=me()' }, function(resp) {
for(var key in resp[0]) {
if(resp[0][key] === "1")
console.log(key+' is granted');
else
console.log(key+' is not granted');
}
});
P.S: On one post I also found a solution which mentioned that the person was able to get the data after deleting the app from his Facebook account and testing by adding it again. Also make sure that if you changed the permissions in the app dashboard, you log out of your application and login again before testing.
I wasted over 3 hours trying to fix this issue and facebook documentation did not help me a bit, so hope this helps someone!