Making call to Facebook's /me/feed connection but no post appears on my profile - facebook

I just got the access token with publish_stream, but when i access below url in browsers, Its not posting message in my wall; It just displays all the feed contents.
Wwhat is the problem, I just want to post a simple message in wall by just visiting a URL like below; Am i wrong somewhere?
https://graph.facebook.com/me/feed?access_token={REMOVED}&message=hello

Two things
That's a GET request, not a POST request - if you can't make a POST request via your code or SDK for some reason, you can simulate one by adding &method=post to the request
You included your access token in the question (now removed) - i strongly recommend changing your password on Facebook ASAP

Related

Facebook graph "/me/photos" endpoint requiring 'Page Public Content Access'

We've had a facebook app which access the authorized user's photos. It uses user tokens.
It had been working for a long time. In the last few days, requests to the graph endpoint me/photos has started giving us an error stating the endpoint requires 'Page Public Content Access'. I can also reproduce this in the graph explorer. Note: it only occurs if I refresh user token, the older tokens seem to work.
We're not attempting to access a public page so this error doesn't seem to make sense. We're only accessing the "me" page and the user token has the user_photos permissions.
Is this error a facebook bug? Do we need to change how we call the graph? Do we need this permission (would prefer to not request it since it doesn't sound applicable to a user-token based app accessing "me" page).
Thanks in advance.
Exact API and error can be seen below:
Weird glitch, and one I can’t personally reproduce.
(And even if the token was a page token, that error would not make sense. /me with a page token automatically resolves to the page the token is for, so this could not be “public access” to begin with.)
There’s already a bug report for this, https://developers.facebook.com/support/bugs/315161742450138/ - though it is currently in “needs more info” status. Maybe subscribe to that, then you will get updated when there’s anything new on this. And you can also comment there, if you have info to add.

Facebook pinging deauthorize callback url with the wrong request

I'm working on a facebook tab app. I need to know when the user uninstall the tab app from their page so that I can update my database. While facebook documentation do not specify how that can be accomplished I read that facebook would ping your deauthorize callback url.
On facebook documentation, they say that they will ping the url with a post request sending a signed_request (https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow#logout), but whenever I remove the tab app from a page facebook send a GET request to my callback url without any signed_request, which doesn't help me to know which page had the app uninstalled.
Access log from my apache server
The 302 redirect is happening because there is no signed request.
What should I do? I can't query all the pages on my database to find out which one had the tab uninstalled because it wouldn't scale, I would need the manage_pages permission and there is no way, without a signed request, to know that the request came from facebook.
Try changing the callback URL to SSL. We had this issue earlier this year and when sending to http:// it was always a GET request but once we changed it to https:// it was changed back to a POST request with the signed_request in the body.

2 different types of user facebook access tokens?

I have set up a facebook app so people can post stuff from my site directly to facebook using the graph api.
I request offline access and manage_pages so that they don't have to be logged in to facebook, but just to my site.
I also have set up the ability to post to a fan page they are managing directly from the site.
both those things definitely work because i have a fan page and i authorized it on my site and am able to post stuff to it directly from my site.
the problem is that when i send the access token to facebook /accounts?access_token=XXX, nothing is being returned for some users even if they are definitely managing (they sent me a screenshot showing they were the manager of the page)
looking at the access tokens i noticed that mine looks like (this is fake):
200785063253279|561ec27497172e3ddvs32dsc.1-10002342352350235|kB2_OoBtsgscsVW2mKMijfNdvb0
while the users in question have an access token like (again - fake):
AAAC2nOrFTH0BAJjMgS3h22ADhirwsfweRT35235LGcZCGisrefwae5tSF535DGlLKJOIBMnrMnI324sfasdSFOIjo325sIigfWOE1aNbvd8wAZD
I can't help but notice the vast difference between the two. is there a reason? is that why i am not getting any page info when i send the request to facebook?
Any help is appreciated!
The first Access Token is the old access Token format and the second Access token is the new Access token format.
This new format was announced a year ago:
https://developers.facebook.com/blog/post/497/
And rolled out last September:
https://developers.facebook.com/blog/post/2011/09/09/platform-updates--operation-developer-love/
Any new Access tokens you get from the system will be of the new format.

How to post status updates to Facebook fan page via API?

I have spent the last few days going through Facebook docs and dozens of blogs/websites and I still cant figure out how to post a status update (to a fan page that I manage) via the Facebook API (programatically)?
This is normally a couple lines of code (with every other API in the world). I am just dumbfounded at the complexity and obscurity with Facebook.
Any pointers?
I don't want to build a UI or deal with sessions or use their "SDK", etc etc...I just want to do a RESTful HTTP POST/s (via PHP CURL).
Thanks in advance.
(BTW, I created an app (so I have an AppID and an AppSecret))
First step (which you have done) is to get the user access token with the publish_stream, manage_pages permissions. Call this USER_ACCESS_TOKEN.
Step 2, get the page access token and use that to publish to the page wall. Getting page access_token:
Call to URL /me/accounts with the USER_ACCESS_TOKEN
The result should include your fanpage and corresponding page token. Get that token, call this PAGE_ACCESS_TOKEN
Then to post to the page wall, call /PAGE_ID/feed with your parameters and use the
PAGE_ACCESS_TOKEN
For more details, see https://developers.facebook.com/docs/reference/api/page/ (look for Page Access Tokens and feed sections)

Facebook Connect Graph API - Why Can't I Retrieve All User's Details?

I feel like every second question i ask here is relating to Facebook Connect - that says a lot about their API. Anyway, that's politics, i digress..
I'm trying to pull back user details from the Graph API for use in my application (which is an FBML external website - JavaScript SDK for authentication).
I have requested the following permissions from the user: (using the regular dialog)
publish_stream
email
This works, and allows me to post to the user's wall, and grab their email from the Graph API.
But when i do a HTTP GET Request to the following URL:
https://graph.facebook.com/uid?access_token=oat (where uid = the user id of the user i'm attempting to grab details for, and oat = the OAuth token i have).
All that comes back in the JSON is the User ID (which i already have, since im putting it in the URL), and the email.
Why can i not get things like first name, last name, locale, etc?
Am i using the wrong URL? Is my OAuth token wrong?
I'm getting the OAuth token from here:
https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=myappid&client_secret=myappsecret
UPDATE:
It looks like the issue is my OAuth token.
Because when i go to the docs: http://developers.facebook.com/docs/api
And use the sample OAuth Token for the user im trying to retrieve, it gets all the details.
Anyone know what is wrong with my OAuth token call?
So, i was using the wrong URL for the OAuth Exchange. It needed to be this:
https://graph.facebook.com/oauth/exchange_sessions?type=client_cred&client_id=myappid&client_secrete=myappsecret&sessions=userseshid
The URL that i WAS using was as per the doco, the above one that works is nowhere to be found.
I'm at the point with FBC that i no longer care about the how, if it works, be thankful that it does even that and move on.
EDIT:
Also, i was wondering why the Graph API calls would "stop" working for no reason.
The answer is i needed to compare the Session Key used to obtain the OAuth token, with the Session Key currently in the cookies. If they are different, i needed to get a new OAuth token.
The session key used for any OAuth token is part of the actual OAuth token:
aaa|bbbb|cccc
Where bbbb is the session key. So i just compare that before doing any Graph API calls.