Performing a facebook search using javascript API

I have a user email and I would like to find them on Facebook using javascript api.

I know that I need something

FB.api('/search', {q: ' user@email.com ', type: 'user'}, function(response) { //Handle response }); 

But this does not work, I do not even get an answer.

I also tried putting it inside and / or after calling FB.login() , which for some reason just doesn't work.

Any suggestions? Their documentation on how to use this is so vague.

EDIT:

Here is all the relevant code:

 <div id="fb-root"></div> <script type="text/javascript" > FB.init({ appId: 'apikey', //Actual API key removed for obvious reasons status: true, // check login status cookie: true, // enable cookies to allow the server to access the session xfbml: true, // parse XFBML oauth: true // enable OAuth 2.0 }); </script> <script type="text/javascript" > FB.login(function (response) { if (response.authResponse) { FB.api('/search', {q: ' user@email.com ', type: 'user'}, function(response) { { alert(response); }); } else { alert(response.toString()); } }); </script> 
+6
source share
2 answers
 var urlCall = "/search?q=Bamboo&type=page&access_token="; FB.api(urlCall, function(response) { //you code to execute }); 

Finally found it after some digging.

+3
source

Do you click on the api key?

I would start here: http://developers.facebook.com/docs/reference/javascript/

and then follow this example which uses 0Auth 2.0 to form the basis of how you will need to make your api requests: https://developers.facebook.com/blog/post/525/ (this article seems to be the very last!)

0
source

Source: https://habr.com/ru/post/897350/


All Articles