tags:

views:

49

answers:

1

Hi,

I'm writing a java application whereby I'd like to post the a user's facebook stream without using the facebook API.

I thought it was possible to just send a POST containing the appropriate details to https://graph.facebook.com/me/feed but this has not proved successful.

Do I definitely need to set the access token in the POST? Can I get away without it if I've chosen to have "offline_access" privileges?

Thanks

A: 

In order to post anything to Facebook, you'll need to be posting from a particular account, which must have authorized your app to post on their behalf. This is what the access token signifies. It is how Facebook knows who you are.

Without the access token, FB would have no idea who was doing the posting, and there would be no way to verify that person had given you permission to post on their behalf.

You can post to https://graph.facebook.com/SOME_USER_ID/feed, but that only determines whose feed you are posting to, and does not specify who is doing the posting.

So in short, you need to do the whole OAuth2 thing to get a token, to post to someone's feed. If a user grants you the offline_access privilege, then you can do this using a stored token without that user being logged in.

All this makes using a library, either the Javascript or some Java library quite attractive.

Cyphus
Yep I did indeed need the access token. I set it up so my access tokens dont expire and I save them in the database. Cheers!
Gearóid