I've got a Facebook oauth token and I'm trying to Like a page for a user who has given me permission to do so. Assuming 123456789 is the id of the Facebook page the user wants to Like, I post to this page and get the following error:
https://graph.facebook.com/123456789/likes?access_token=...
{
"error":{
"type":"OAuthException",
"message":"(#3) Application does not have the capability to make this API call."
}
}
This page of the Facebook documentation (https://developers.facebook.com/docs/reference/api/) says:
You can comment on or like any object that has a /comments or /likes
connection by posting to https://graph.facebook.com/OBJECT_ID/comments
and https://graph.facebook.com/OBJECT_ID/likes, respectively
The user wants to Like a Facebook Page and the Page documentation (https://developers.facebook.com/docs/reference/api/page/) shows that it does have a /likes connection, so it should be Like'able via the api... but it's not working. Any ideas?
Currently this is only possible with the old (and DEPRECATED) REST API. Using the method "pages.addFan". Though this method is not visible in Facebook's API Documentation.
So I assume that this is also possible somehow with the new Graph API, because their Facebook mobile apps will need to move on to their new APIs soon, and they make use of the Page Like function.
What's really weird, is that their brand new iPad app, is based on the old REST API! Interesting...
Related
I am trying to extract my posts, via Graph API from facebook. I used some basic code snippets but they don't work. I can not get my feed even in the Graph Explorer. It always says that I don;t have the permission and I have to submit my App for review and provide a video tutorial on how I use the extracted posts.
But I want to extract just my posts, I don't care for anybody elses. Do I seriously need FB App review to do that?
This is what I get with my token from my app:
user/posts requires additional contract signing:
Use /me/posts with your own App, with your User Token and authorize with the user_posts permission. This works without any approval from Facebook - for your account and your App only, of course. I just tested if it still works in the Graph API Explorer and it did: https://developers.facebook.com/tools/explorer/108138225915615/?method=GET&path=me%2Fposts&version=v5.0
I am trying to register users via Facebook using django rest-auth.
As per the installation docs here, a rest call to register a user via facebook requires an "access token" and "code". I know what an access token is, but what is "code"?
First of all, you need to create a Facebook Application in the developers page. You will get a Facebook app code and a secret.
For using the /rest-auth/facebook/ method from the django-rest-auth, you need to send the access code (obtained using the javascript SDK) and the code of the Facebook Application.
Finally, before using this method, you have to go the the application back-office and create a social application, using the Facebook app code and the secret.
Unfortunately I'm struggling to understand the documentation provided by Facebook.
This is the scenario:
- Some of my iPhone Apps are also registered as Native/Desktop Apps on Facebook in order to support the Facebook Audience Network.
- I'm building a tool in python which will retrieve data from the reporting API in order to run some automated analysis on specific metrics (request, impressions and so on).
The question is: how do I retrieve this data?
The documentation for the reporting API is here: Reporting API
However I'm struggling with the access token.
It says that I could use the specific App Token available here: App Tokens
However by using such token, I get an error saying that app tokens can't be used for Desktop/Native Ads.
What is the correct way to do it then? Here is where I struggle to understand Facebook Documentation.
My guess is that I should use a User Access Token instead, generated for a user that is also the admin of the App for which I want to retrieve the insights.
What really freaks me out is that apparently, this can't be done with normal HTTP calls only but it requires instead to go through the Facebook Login Dialog. I also need to create another Facebook (web) app because there is no way to get a simple "User Object"... Everything needs to start and go through a registered Facebook App. And there's no way to go through these steps by using backend code only.
So... to recap... in order to read the Insights for a Native/Desktop Facebook App (APP_A), I have to:
- Create a new Web Facebook App (APP_B)
- Create a web interface somewhere for APP_B) which will trigger the Facebook Login Dialog and request the read_insights permission.
- Login through this web interface and generate a User Access Token
- Put this User Access Token in my backend code and run the scripts that retrieve the data provided by the Reporting API for APP_B
Really... to me... it doesn't make any sense to create a new Facebook App in order to access the data of another Facebook App.
Isn't there another better, simpler, quicker, cleaner way to achieve the same final result?
How could I get the facebook page feed, when the user isnot loged in.
I could get app access token,after that how I need to fetch data via graph api.
Please provide a sample and could I test that in facebook explore tool.?
All you really need to do is make a request to:
https://graph.facebook.com/v2.0/PAGE_ID?access_token=APP_ACCESS_TOKEN
So, for example, to get CocaCola's page feed, the request would look something like this:
https://graph.facebook.com/v2.0/40796308305/feed
The endpoint you're dealing with here is /{page_id}/feed. The relevant documentation can be found here - https://developers.facebook.com/docs/graph-api/reference/v2.0/page/feed.
For your convenience, here is a link directly to the API explorer with the relevant query:
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=40796308305%2Ffeed&version=v2.0
I need to make POSTs to facebook page timeline (not auto posts, but when a user on an enterprise application submits a form). Note that a user should bot be logged in on facebook!
I've searched a lot and seems i should use graph api to do this... but, it's possible to achieve this without creating a facebook app?
I don't wish any user have this app... i just need to make POSTs to a facebook page that i own. So, it's not a public app.
I've made some tests with graph api explorer, after creating an app, and i'm trying to POST and always get error "An active access token must be used to query information about the current user.".
So, i'm using the correct access token (app access token in this case)... how can i test this? I should have my app submitted to be reviewed already? I just want to make some tests, to see if this actually works as i need to... don't wish to publish app now.
Could someone point me to the right direction?
Thanks!
An App Token is the wrong Token to post to a Page. You would need to use a Page Token for that. At least if you want to post "as Page". If you want to post "as User", you have to use a User Token. Everything you need to know is in the docs: https://developers.facebook.com/docs/graph-api/reference/v2.5/page/feed#Creating
More information about Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/