Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook graph API: simple search for users by name

I would like to do a simple search for users by their name from a desktop application using Facebook's graph API. The result I want to have is a list of user names and the link to their profile. I spent several hours reading the documentation but it is still not very clear to me, which access tokens I would need. I have created a developer account on Facebook and added a new app. I've got an app access token and I've tried to do a search using the following URL:

https://graph.facebook.com/search?q=john&access_token={my_app_access_token}

I got the following response:

{
   "error": {
      "message": "An unknown error has occurred.",
      "type": "OAuthException",
      "code": 1
   }
}

My question now is, if it is possible to do such a simple search without user access token. So the user sitting in front of my desktop application should NOT have to enter his facebook credentials somewhere - never. Can this be done somehow?

like image 791
Peter Avatar asked Aug 13 '15 12:08

Peter


People also ask

How do I get my Facebook graph API User ID?

The simplest way to get a copy of the User Profile object is to access the /me endpoint: FB. api('/me', function(response) { }); This will this will return the users name and an ID by default.

How do I find Facebook user data?

You can get user data by using the Facebook Graph API if the user has given their permission to share their data and your app has the appropriate permissions to receive this data. This topic shows you how to make a single request for data and how to have a batch of requests in a single request.

Does Facebook Graph Search still work?

In early June 2019, the feature was further deprecated, with the majority of URLs for graph search queries no longer working. Facebook explained this by saying: "The vast majority of people on Facebook search using keywords, a factor which led us to pause some aspects of graph search and focus more on improving keyword ...


1 Answers

When searching, you should provide the search type (in your case user) and to answer your question, no, a user access token is required to search, app tokens won't work for user searches (documented here)

like image 92
Björn Kaiser Avatar answered Oct 30 '22 16:10

Björn Kaiser