I have 2 questions
Does the requestPermissions field go here(Running on click)
Meteor.loginWithFacebook({requestPermissions: ['user_friends']});
or here
ServiceConfiguration.configurations.insert({
service: "facebook",
appId: Meteor.settings.facebook.appId,
secret: Meteor.settings.facebook.secret,
requestPermissions: ['user_friends']
});
When adding the requestPermissions field to the ServiceConfiguration, it does not seem to take any effect.
Both options don't show the friendslist on the services.facebook field. where can i find the friends list? Is this a bug with the current facebook accounts package? I also tried doing this
Accounts.onCreateUser(function (options, user) {
debugger;
// nothing here, options just holds name.
return user;
});
Help please
Check: http://docs.meteor.com/#/full/accounts_ui_config and also https://developers.facebook.com/docs/reference/fql/permissions/
You need ask Facebook for the permissions, there's a review process for this. It's useless to request a permission that Facebook didn't provided you. Read this topic about recent facebook changes to the API: Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app
I'm using the fbgraphpackage to query Facebook: https://github.com/criso/fbgraph
Related
I can't create a Facebook album via graph api. Now, it always throws a error
(#10) Application does not have permission for this action
I don't know why. I'm sure I have the correct access token (it is a valid, it does not expire). I have the same error in php & javascript.
My example code in js:
FB.api('/me/albums', 'post', {
access_token: access_token, // it is a valid
name: 'test album 1',
message: 'test album 1'
}, function(res) {
console.log(res); // throw a error "(#10) Application does not have permission for this action"
});
Does Facebook have some bugs or I missed something?
Edit: I found the correct answer from https://developers.facebook.com/bugs/680991411993635/:
Even though you are using a Page Access Token, you need the
user_photos permission in order to create a Photo Album as the Page.
Facebook does have some bugs...don't we all?
You actually did miss something - you need the correct permissions.
In order to create an album, you'll need to request the publish_actions permission from your users. This permission allows your application to publish stories to the users feed including new albums.
I have web application where I use Facebook oauth. User authentication works fine. and in javascript when I call FB.getUserID() I get correct identification. But when I try do this I get empty array:
FB.api('/me/albums', function (response) {
console.log(response.data);
console.log(FB.getUserID());
});
What I do wrong?
In order to retrieve the albums created by that user, you must provide user_photos permission to your access token.
Have a look at the this documentation on albums. It clearly says under permission that your Access Token must have the user_photos permission to retrieve the the albums. Without
this specific permission, it'll return an empty object.
Now, in order to provide one or more additional permissions, call FB.login with an option object, and set the scope parameter with a comma-separated list of the permissions you wish to request from the user.
FB.login(function(response) {
// handle the response
}, {scope: 'user_photos,friends_photos'});
Reference: Javascript FB.login doc
Bit of an odd one: I've created an app that uses a jQuery AJAX request to query the Graph API and access a list of a given user's Likes (someone on my Friends list). I can use this within my app, and I get the same result as if I'd run the query through the Developer tools Graph API Explorer site (https://developers.facebook.com/tools/explorer).
The fun begins when people on the Testers list for the app (which is sandboxed) perform exactly the same actions, with the same friend (who isn't on the testers list); they don't receive any data back from the Graph API at all.
The testers have granted my app all the same permissions as I have, so why would we be getting different results?
Finally - I think I've found the solution.
By switching the Facebook JavaScript SDK file to a direct link rather than an asynchronous download, and calling the FB.login function with extra permissions defined in the scope later down the page:
FB.login(function (response) {
if (response.authResponse) {
// init app here
} else {
// cancelled
}
}, { scope: 'user_likes,friends_likes' });
... the testers are able to access their friends' Likes. Phew!
I have a situation on my site where a user who has authorized my app can later opt to get their friends list so I want to check their current permissions before executing anything. I have found I can use
FB.api('/me/permissions', function(response) {
console.log(response);
});
I want to check if the user has read_friendlists permission but I have not found any information about the object so I do not know how to write a condition against it. Facebook has an example of returned data on this page http://developers.facebook.com/docs/reference/api/
but like I said I have not found a resource which describes the object.
Thanks for the help
If there's no read_friendlists entry in the response, you don't have that permission - write your condition based on the presence, or lack thereof, of the particular key (permission) you need
I want to get the statistics of all the pages associated with my account on facebook, i have the code to get the statistics of a page, i just want to get the page id of all the pages associated with my account, how can i do this?
Please help.
Thanks.
You'll need to request the manage_pages permission (more details here), once you have the aquired the permission, all you have to do is make a request to :
https://graph.facebook.com/YOUR_FACEBOOK_ID/accounts.
The return value will be a JSON with all the pages/applications that are associated with your account.
You can also use this great tool that facebook provides - The Graph API Explorer (/me/accounts) to explore what other information you can retrieve without having to write a single line of code :P very useful.
FB.api('/me/accounts', function(response) {
for (id in response.data)
{
page = data[id];
page.id;
page.name;
}
});
You can use Javascript API to do this, read more :http://developers.facebook.com/docs/reference/javascript/