I am trying to get the mutual friends between the user logging in and some other person. I am using Laravel 4.2 and artdarek/oauth-4-laravel . I can get this sample script to work just fine:
public function loginWithFacebook() {
// get data from input
$code = Input::get( 'code' );
// get fb service
$fb = OAuth::consumer( 'Facebook' );
// check if code is valid
// if code is provided get user data and sign in
if ( !empty( $code ) ) {
// This was a callback request from facebook, get the token
$token = $fb->requestAccessToken( $code );
// Send a request with it
$result = json_decode( $fb->request( '/me' ), true );
$message = 'Your unique facebook user id is: ' . $result['id'] . ' and your name is ' . $result['name'];
echo $message. "<br/>";
//Var_dump
//display whole array().
dd($result);
}
// if not ask for permission first
else {
// get fb authorization
$url = $fb->getAuthorizationUri();
// return to facebook login url
return Redirect::to( (string)$url );
}
}
But I don't know the syntax to request mutual friends for another facebook id, say 1457655547838343. I know the key is probably with line 18, specifically $fb->request( '/me' )
. I've tried about 100 different things, including $fb->request( '/me/mutualfriends/1457655547838343' )
and others. Can somebody please just point me in the right direction?
First off, Facebook has changed their policies to only allow an application to see mutual friends WHO HAVE ALSO SIGNED IN THROUGH THE APP. This limitation makes the mutual friend thing pretty useless for what I was trying to do.
Also, I ended up just using Facebook's official php SDK and everything else I was trying to do works great.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.