Laravel,Facebook API:检索朋友的朋友 [英] Laravel, Facebook API: retrieving friends of friends

查看:105
本文介绍了Laravel,Facebook API:检索朋友的朋友的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上一个线程,我们正在使用Laravel应用进行Facebook登录.现在,当用户使用Facebook登录到我们的应用程序时,我们正在尝试获取其朋友的列表,以便提供一些合格的建议.因此,这是我们正在尝试的方法:

In a previous thread we were strugling with the Facebook login using a Laravel app. Now, as the user logs into our app using Facebook, we are trying to get his friend's list in order to provide some qualified suggestions. So, here's what we are trying:

Route::get('login/fb/callback', function() {
// A FacebookResponse is returned from an executed FacebookRequest
    $helper = new FacebookRedirectLoginHelper('http://yoururl/login/fb/callback');
    $session = $helper->getSessionFromRedirect();
    $request = new FacebookRequest($session, 'GET', '/me/friends');
    try {
        $response = $request->execute();
        $me = $response->getGraphObject();
    } catch (FacebookRequestException $ex) {
        echo $ex->getMessage();
    } catch (\Exception $ex) {
        echo $ex->getMessage();
    }

    print_r($me);//->getProperty("id"));
    $user = new Giftee;
    $user->name = $me->getProperty('first_name') . ' ' . $me->getProperty('last_name');
    $user->email    = $me->getProperty('email') . "@facebook.com.br";
    $user->photo    = 'https://graph.facebook.com/' . $me->getProperty('id') . '/picture?type=large';

    $user->save();

});

结果,我们得到:

object(Facebook\GraphObject)#146 (1) { ["backingData":protected]=> array(0) { } }

通过阅读Facebook API文档,他们几乎说user_friends将仅返回已经使用您的应用程序的朋友的朋友,而我们看不到任何会返回朋友的朋友的登录权限(不仅是使用我们应用程序的朋友) .换句话说,我们想要的东西真的不可能吗?

By reading the Facebook API docs, they pretty much say user_friends will only return friends of friends that already use your app and We could not see any login permission that would just return friends of friends (not only the ones using our app). In another words, is what we want really impossible?

推荐答案

您无法检索朋友的朋友.使用Graph API v2.0,您甚至只会吸引同时使用您的应用程序的用户朋友.

You're not able to retrieve friends of friends. With Graph API v2.0, you even only get those friends of your app's users which also use your app.

并且,所有friends_*权限均已删除.因此,我认为您没有实现自己想要实现的目标的机会.

And, all friends_* permissions have been removed. So I don't see a chance for you to implement what you want to achieve.

这篇关于Laravel,Facebook API:检索朋友的朋友的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆