views:

93

answers:

2

i am creating an app using the facebook C# api

i want to read the data on this wall:

but when i call the api and essentially hit this URL:

https://graph.facebook.com/123176767150

I get this error:

{
   "error": {
        "type": "OAuthException",
       "message": "An access token is required to request this resource."
}

}

why do i need Authentication to get public data that i can see without logging into a facebook account ?

+4  A: 

Because Facebook does not mind you as a user seeing this information but does not want applications to be able to harvest data. Obviously it would be a lot faster for you to use the graph api to get everyone's names off their posts to the group wall (hypothetical) than for you to do it manually. The only publicly available information without an access_token is the basic user information (and this is only for users and not any other object). In order to achieve what you want you will have to acquire an access_token.

This is the same as the fact that as a user you can see anyone's friends when logged into Facebook, but as an application you can only see an Authorized user's friends.

You can, however, authenticate your application with the ability to access non-user specific private information by authenticating via the following method:

Make a GET request to:
https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=CLIENT_ID&client_secret=CLIENT_SECRET

Facebook returns:
access_token=SOME_TOKEN

Use this token as your access token and it should allow you to access the group. I have tested this with my application and can confirm it works.

You request the wall information via the request:
https://graph.facebook.com/123176767150/feed?access_token=SOME_TOKEN

See here under the Authenticating as an Application section

BeRecursive
@BeRecursive - so if i do want to read the full wall do i need to create a facebook account? Is there anyway to create a system account just for these purposes as i am trying to do this for a non profits website so i dont want my personal login to be associated with this
ooo
See my updated response in my answer
BeRecursive
To clarify: you have to have an account to make a facebook application. The detailed method allows access to non-user specific private information on behalf of your application
BeRecursive
A: 

so that FB knows who's requesting the data. FB needs to know the agent that accesses any type of data.

this. __curious_geek
@this. __curious_geek - so if i do want to read the full wall do i need to create a facebook account? Is there anyway to create a system account just for these purposes as i am trying to do this for a non profits website so i dont want my personal login to be associated with this
ooo

related questions