Strange Access Token returned from Facebook - facebook

I have been working on Facebook app and I have been using Facebook Graph Toolkit for months and all the while, MY CODES are working (I can get Access Token, and I can use them to retrieve Facebook user details, publish news feed, etc)
Now, there's new problem arise that I never expect it to happen and didn't know what is wrong with Facebook!
I have been following my old set of codes and discovered that Facebook now returns back Access Token that is not in this format (which is the correct format all the while I'm using, it is even the same format found in this page
|c4e304f814362ec6b6dd823a.1-|LeRzWafqGjfriGabNmmOU4U07Pw
Now, I've been getting the format like this
AAABddZAETAbYBAKNESQCdiZC2ojQOjSAIHfFCBFtn99wUYC448po2FN4VrvempAQVnUaBwJb9Qxwg6j9uegLZAeaZA4vmh503bHkUIsj1hIl1ZCvCbZBkz&expires=6204
Anyone knows what happen??

This is the new style access_token. You can see it working by visiting this link:
https://graph.facebook.com/me?access_token={access_token from your question}
This change has been advertised on the Facebook dev blog:
https://developers.facebook.com/blog/post/497/
...
https://developers.facebook.com/blog/post/555/
I can't, however, yet answer why the style of the access_token has changed, because the documentation hasn't been updated yet to show this change: https://developers.facebook.com/docs/authentication/
Note: I suggest you remove the access_token from your question, as it means others are able to access your data!

This looks to be the new encrypted access token that Facebook is moving to. Will probably be the norm. If you were previously parsing it for different bit's of info you'll probably need to change to decoding it.

Related

Breaking change with link field when posting to facebook feed via api

We have a facebook website application that posts to user home page feeds as well as feeds to pages which they administer.
Until recently everything worked fine (maybe until the beginning of the year when the 1.0 API was discontinued). The problem turns out to be the presence of the "link" field.
All is well when posting to a user home page. But when we post to a another page the user is an admin of (or a group), the call fails with the following error.
The error that returns is:
{ message: '(#200) Permissions error',
type: 'OAuthException',
code: 200 }
Removing the link field is enough to make the call work again. I had thought we might affected by this issue: Stream post URL security - Website/FB page url. However, our applications Stream post URL security migration is set to off and we are linking to a url in our domain. When posting to a home page the url can be within our app domain or without and all works fine.
As I've been testing I've boiled the calls down to the following in every version of the api.
{{facebookId}}/feed?link=http://cir.cl
{{pageId}}/feed?link=http://cir.cl
For the former we use the long-lived token we got after authenticating. For the latter we use the token returned by {{facebookId}}/accounts or {{facebookId}}/groups. The former works. The latter fails, but changing link to message=foo works fine.
Has anyone noticed a breaking change that touches on this issue?
It turns out it's a valid bug and our friends at Facebook are addressing it:
https://developers.facebook.com/bugs/755514351208694
How often does that happen? I'm just surprised the internet isn't blowing up about this. Dozens and dozens and dozens of applications must be affected.

how to find graph URL for a page when http://graph.facebook.com/pagename doesn't work?

For most (all?) Facebook pages, I can access its graph data by getting the last part of its URL and adding it to http://graph.facebook.com. For example, http://graph.facebook.com/AKON pulls up data for http://www.facebook.com/AKON.
However, here's a page that doesn't work like that:
http://www.facebook.com/codblackops
Instead, http://graph.facebook.com/codblackops returns False.
What gives? And is there any way to figure out the correctly graph address from the www.facebook.com/codblackops page (or page source)?
If a page returns false then it is either because you're missing access_token privileges or due to geographical restrictions.
In order to make an access token that does not expire you can use the following question as a guideline: Do Facebook Oauth 2.0 Access Tokens Expire?
The biggest problem is even I have no access to that site. It's probably private/hidden, because it's redirecting me to the homepage. Check permissions and try again

Getting facebook profile picture

i need to get the facebook profile picture of anyone by passing their id. But i no need to use facebook API or Graph anything else.. Just i need to give the url with that id.. Is it possible to get the profile picture in this way? I tried in google but i didnt get it. If anyone knows this please respond me...
Well, I think the only options available are:
https://graph.facebook.com/[PROFILE_ID]/picture (You can include this URL inside a tag and it will work).
Scrap yourself the page corresponding to the profile, i.e. http://www.facebook.com/profile.php?id=[PROFILE_ID] and get the URL of the picture there.
I would suggest you to use the first one, because it gives you more flexibility about the picture size (?type=small, ?type=thumbnail, etc).
Edit
Keep in mind that this answer is from 2011, and Facebook makes changes in its APIs frequently.
Apart from using Graph API as already mentioned above (https://graph.facebook.com/[PROFILE_ID]/picture), there are a couple more ways:
FlipTop has a service that pulls up all sorts of information on Facebook users, including direct CDN URLs (e.g. https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/275588_504804917_147319_n.jpg) of profile pictures. (Link to API documentation)
Cloudinary has a similar service, but with hosting thrown in the mix. They do require you to open an account, but it's free. Then you can use their CDN URL format to link to any picture like this: http://res.cloudinary.com/[YOUR_ACCOUNT]/image/facebook/[PROFILE_ID].jpg (Read more here)

facebook graph api does not return all feed items on facebook page

at the time of this question, if you go here:
http://www.facebook.com/realplayer
you'll see six posts down, I have posted a photo with a message of "#highfive Cincinnati, OH"
but if you to either of these:
http://graph.facebook.com/realplayer/feed
http://graph.facebook.com/realplayer/tagged
the JSON that is returned seemingly includes everything on the wall, except for MY post. there is another photo post from someone else down below mine, and it is showing up (and both my photo and his photo are in the "Fan photos" section)
obviously, since I can see everything with these links already, it appears that access_token is not a part of the equation... BUT, some more info:
if I use an access_token from a session that isn't me, I can't see the post in the JSON
if I use an access_token from MY logged in session, then I DO see the post in the JSON
so I'm very confused.
if everyone in the world can see those posts on the wall without even authenticating, then I expect all of them to come back in the graph api as well.
anyone have thoughts on this?
I am aware of the "manage_page" permission... which I can use to get a list of accounts and special offline access tokens for those pages... and that's something I can explore... but it seems like alot of work when my post seemingly SHOULD be there in the graph
well looks like FB has this nice little anti-spam feature for pages... such that a non-admin can't write lots of messages on your page. what's interesting is that facebook uses similar "silent treatment" techniques that StackOverflow uses ( https://blog.stackoverflow.com/2008/09/podcast-21/ )... so when I look at a wall that I've been "spamming" I will see all of my posts... but no one else will.
I was able to create a new test account and get about 3 or 4 messages on a page before it started blocking me again
so probably the Graph API is working as designed :)
========================
UPDATE: this appears to only be part of the problem. I have constructed another page and app and been doing testing:
http://www.facebook.com/pages/RP-Test-Page/116735865065591
note the entry for "#highfive Orlando, FL" ... even an unauthenticated user can see this entry from the actual page... but there is seemingly no way for me to get it back through the API. He only posted once, so it can't be an "anti-spam" thing (you wouldn't think).
I have obviously tried the Graph API (with and without my own access token)
I have tried FQL (with and without my own access token)
and I have followed this post:
http://en-gb.facebook.com/topic.php?uid=10381469571&topic=3815&post=51980
in order to request manage_pages and offline_access extended permissions from myself and use that to get the /me/accounts and then get the "impersonation" access token (whew)... STILL NOTHING
there must be some other super security thing going on. is it not possible to reliably get all of the wall posts from a page?

Facebook graph API: feeds missing in json response

I try to fetch user's feeds via graph api from my Android application. It generally works but some feeds that I can see on the wall are missing in the json response.
I call the url http://graph.facebook.com/someUserId/feed, by using the Android Facebook SDK methods, so the access token should be provided automatically, but it's not really relevant I think in my case. Nevertheless fyi, the user of my app is authenticated via OAuth.
I already checked the following:
all the user's feeds are visible to everyone / public (set in privacy settings)
the json response is not cached by my browser
I am aware of paging, but this is not an issue. The problem is not that I am not getting the very oldest feeds but that some feeds are just missing in between.
I registered a new facebook user which is not connected to the user I want to retrieve the wall feeds from, and when I open the respective wall I see all the feeds there, as expected, since they're all public to everyone. Yet, when I open the same related json url unter http://graph.facebook.com/someUserId/feed, some feeds are missing.
This is an example of the problem - since all my posts are public, I can just call the json url directly in a browser to do a test.
I want to get wall feeds from user:
http://www.facebook.com/mathias.lin
Screenshot1: note the 3 marked postings, all posted by myself
and here the json response, as you can see, the 1st and 3rd wall posts are included in the json, but the 2nd post is not. Why?
The related json url is:
http://graph.facebook.com/mathias.lin/feed
I am getting the 'missing' feed when I add an access_token to the url - but why? The posted feed has a privacy setting for 'everyone'?!
This is the missing feed that I get when using the access_token:
{"id":"504063796_485195138796","from":{"name":"Mathias Lin","id":"504063796"},"message":"Photo test upload from Android","picture":"http:\/\/photos-e.ak.fbcdn.net\/hphotos-ak-snc6\/hs021.snc6\/165194_485195123796_504063796_6062399_1841907_s.jpg","link":"http:\/\/www.facebook.com\/photo.php?fbid=485195123796&set=a.485195118796.256450.504063796","name":"Torres Photos","icon":"http:\/\/static.ak.fbcdn.net\/rsrc.php\/yz\/r\/StEh3RhPvjk.gif","actions":[{"name":"Comment","link":"http:\/\/www.facebook.com\/504063796\/posts\/485195138796"},{"name":"Like","link":"http:\/\/www.facebook.com\/504063796\/posts\/485195138796"}],"privacy":{"description":"Everyone","value":"EVERYONE"},"type":"photo","created_time":"2011-01-06T05:10:43+0000","updated_time":"2011-01-06T09:00:23+0000","likes":6,"comments":{"data":[{"id":"504063796_485195138796_3607414","from":{"name":"Mathias Lin","id":"504063796"},"message":"Awesome, photo upload now works as well. Not so much fun working with the Facebook SDK for Android, would have expected more functionality beyond that just very very simple graph api wrapper. But need to be considered that the android sdk development was part of an internship - but since it's it's open source, it can luckily be modified. Which has to be done due to some bugs (mixing up the bundle parameters for a post, getString, getByteArray). Api documentation could be improved.","created_time":"2011-01-06T05:26:04+0000"},{"id":"504063796_485195138796_3608020","from":{"name":"Renate Hermanns","id":"628810487"},"message":"Wow
, how fast time passes by. Your daughter is nearly grown up ;-).","created_time":"2011-01-06T09:00:23+0000"}],"count":2},"attribution":"Torres"}
I've already posted the question to the FB dev forum, awaiting response.
Related threads:
http://forum.developers.facebook.net/viewtopic.php?id=81365
http://forum.developers.facebook.net/viewtopic.php?id=75984
Facebook Graph API "/userid/feed" returning Blank
Your approach is correct, I've seen the JSON and yes it's missing the second one, I think it's upload app form adroid, try checking the application settings for this app. Or If your trying to retrieve the wall FQL is a much better way
SELECT post_id, actor_id, target_id, message FROM stream WHERE source_id in (SELECT target_id FROM connection WHERE source_id=<uid> AND is_following=1) AND is_hidden = 0
I've been through this, the way Facebook is categorizing their permissions is somehow misleading, for example Publicly available may sounds like Available to everyone on Facebook but apperantly it's not.
Now in your case, if you already authenticated the user, then try using:
/me/feed
I guess this is the only case where access_token is not needed in the URL.
I had a similar problem. But for me, the problem was related to not setting the scope properly on first login (to authorize the app). I posted a similar question and got an answer that worked for me here:
Facebook API how to get all wall items