tags:

views:

258

answers:

3

I can make a search query using these tokens here:

http://developers.facebook.com/docs/api#search

in the links:

https://graph.facebook.com/search?q=mark&amp;type=user&amp;access_token=2227470867|2.3eR1b7yrD6oU8Odh0PEhZA__.3600.1279843200-100001317997096|yDCYeMeuUisyjC7x5k_nuU3DjT0. (<-this token expires within hours)

However I cannot make search using my own tokens that I get from here:

https://graph.facebook.com/oauth/access_token?type=client_cred&amp;client_id=114187648630446&amp;client_secret=e6c82f822a35ed2821d91c8537931917

access_token=114187648630446|vwcRSfa8CotC7rdZ1YnvsqqWMIY.

What is wrong? How I'll get tokens like this one: https://graph.facebook.com/search?q=mark&amp;type=user&amp;access_token=2227470867|2.3eR1b7yrD6oU8Odh0PEhZA__.3600.1279843200-100001317997096|yDCYeMeuUisyjC7x5k_nuU3DjT0

(note: I do not care about my secret keys etc etc, that is Facebook's business, I want it work, I'm trying to make a simple search, it passed 2 days since I started, please don't tell me to read developer's page because they write it to themselves, I do not understand why my tokens do not work, what I miss, their help pages are not helpfull, so I'm asking you here)

And there is no something like user authentication. It is like www.spokeo.com

+2  A: 

I had the similar problem until I found this nice tutorial:

Facebook Graph API — getting access tokens

Sarfraz
+1  A: 

I know you asked not to say this, but if you read the Authentication docs, I think it's well explained enough, and with PHP examples.

You do need to register your application, but you mentioned nothing about it, so did you already?

http://developers.facebook.com/docs/authentication/

Bruno Bernardino
+1  A: 

The long access tokens are the session tokens, and are used for operations that require a logged-in user. The short access tokens (the ones returned from oauth/access_token?type=client_cred) can only be used for a limited set of operations. Searching of user names requires a session token.

In order to do searching of user names, you'll need to use either the web flow (oauth/authorize) or, possibly, the desktop application flow (oauth/authorize?type=user_agent). Either one, however, will require the Facebook authentication dialog to come up.

You might just let the user login -- oftentimes, the user is already logged into Facebook, so authorizing through Facebook isn't a big deal.

(Oddly, even though name searches require a session token, the Facebook directory is publically available and can be crawled).

brool