Passing permissions to Facebook Graph API using Postman - facebook

How can I access anything more than name, pictures, that require permissions in Postman?
I have this code https://graph.facebook.com/v2.9/me?fields=name,birthday&access_token=[my access token] but it only shows the name and id fields
It works in FB graph API but how can I do it in Postman

That call works fine for me:
https://graph.facebook.com/v2.9/me?fields=id%2Cname%2Cbirthday&access_token=my_token
using postman and curl (as Facebook's graph API console says in the get code button under the form).
I'd make sure that your token is really the same in both scenarios and that the fields you request are allowed there.

Related

How to get a page access token?

I want to generate a page access token with graph API 5.0 and don't know how to do.
I have an app, linked to a page which I am administrator, with all the permissions I need.
Everything works fine inside the graph API explorer.
The documentation says I need a user access token in order to get the page access token, using https://graph.facebook.com/v5.0/me/accounts?access_token=$user_access_token.
The problem is I don't know how to get it programmatically without having to confirm in the facebook popup. All I have now is the app access token, but this is an invalid parameter this endpoint.
Does somebody know where I'm wrong?

How to embed a Facebook Page's public info (like count) to a website using Graph API v2?

My previous implementation of using GET request to url https://graph.facebook.com/538726722826117 is broken now that Facebook has moved to Graph API v2 and requires an auth token for fetching this information. And as it is a website, I cannot embed a token which would have any more access rights than for reading a page's public information.
How to implement this rather simple task of getting a page's public like and check-ins count?
You don´t need to autorize, you can just use an App Access Token for the API call. Of course you should not use the Token on the client, but it´s perfectly fine to use it on the server. Make the API call with file_get_contents or curl - that is, if you are using PHP.
An App Access Token is very simple, it´s just the App ID and the App Secret, combined with a pipe sign: App-ID|App-Secret
More information about Tokens for the Facebook API:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/

Facebook API error : (#210) Subject must be a page

I am trying to delete an application tab from a facebook page.
According to the documentation, I should issue a DELETE request to "https://graph.facebook.com/PAGE_ID/tabs/app_ID" with a "manage_pages" access token, but when I do so I get the error "(#210) Subject must be a page."
I have requested the user for "manage_pages" permission and I have the correct access_token (GET Method works perfectly to show all the details).
The exact request is:
https://graph.facebook.com/270936169730418/tabs/app_533644953422033 (with an access token)
Does anyone know what am I doing wrong??
P.S I am using JS SDK and also trying to do this in the graph api explorer but results are the same.
The problem is with the access token. When using the Graph API Explorer (and checking "manage_pages") you might think that the access token showing at the top is a page access token. It is not.
You need to do GET /me/accounts
Then find the page you want and there is an access_token. Copy this and paste it into the Access Token input field at the top. Now do the DELETE [PAGE_ID]/apps_[APP_ID] and it will work.

Facebook Login As App, access token doesn't work

I am trying to get events from a Facebook page via Ajax.
But there should be no login process for user. For this reason I am trying to implement "Login as an App" by following the the documentation on this page.
I am getting the access token correctly by
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID
&client_secret=YOUR_APP_SECRET
&grant_type=client_credentials
However when I try to query Facebook Graph API with this access token I am getting an empty result set.
This is an example request;
https://graph.facebook.com/FAN_PAGE/events?access_token=ACCESS_TOKEN
I know the result set should not be empty because the same request with Graph Explorer returns the correct values.
Even a request like https://graph.facebook.com/FAN_PAGE/events?access_token=ACCESS_TOKEN_FROM_GRAPH_EXPLORER works correctly.
Any idea on whats going on? How can I get this to work correctly?
Actually the reason was not about the access token. The reason is that the page I want to get the events for is restricted. This works fine for unrestricted pages.
After a little research I found out that to read a restricted page's events (or posts etc.) you need a user access token. You get this by asking the user. (at login flow)
The other solution to get this data without prompting for a login is to get "page access token". You can generate a page access token by following this link.
And more on Access Tokens

How to implement Facebook Like in non-Javascript environments

I am working in mobile environments that do not support Javascript. Is it possible to add Facebook Like functionality to a page, probably doing server-side requests to Facebook?
For a more detailed example, if I go to http://ogp.me/, there is a Like button towards the bottom of the page. Clicking on that uses Javascript, optionally signing into Facebook if the relevant cookies aren't there.
I want to provide the same functionality, but without using Javascript (clue: need to support Blackberry browsers).
My intention was to use OAuth 2.0 with standard redirects, to get an access token with which to call the Graph API.
Once I have an access token, I was expecting something like
curl https://graph.facebook.com/me/likes?access_token={a-valid-access-token}&category=Website&url={url-encoding-of-url-to-like}
where the access token has the publish_stream permission granted to it. So to be more explicit:
curl https://graph.facebook.com/me/likes?access_token={a-valid-access-token}&category=Website&url=http%3A%2F%2Fogp.me%2F
That attempt returns me a 403 response, and I've not found anything else in the fine manual
The graph api does allow you to like a graph object (see Graph API Docs / Publishing) using:
https://graph.facebook.com/OBJECT_ID/likes
However the graph object must have an existing likes connection - and there's currently no way of creating such a connection via the graph api.
But if the like connection already exists you can get the pages graph object id using FQL:
SELECT id FROM object_url WHERE url='http://youtargeturl.lnk'