【问题标题】:How to get my all friends using spring social facebook template?如何让我所有的朋友使用春季社交 Facebook 模板?
【发布时间】:2015-07-27 12:53:15
【问题描述】:

我正在 Spring Boot 上开发项目,我正在使用 Spring Social facebook api 来获取用户个人资料及其朋友。我的代码是

Facebook facebook = new FacebookTemplate(socialAuthToken);
        org.springframework.social.facebook.api.User facebookUser = facebook.userOperations().getUserProfile(); 

上面的代码工作正常,它给了我我的个人资料,但是当我尝试获取我的朋友的个人资料时,它通过分页只给了八个用户,但我想获取所有用户。 交朋友的代码

List<String> friendsIds = facebook.friendOperations().getFriendIds();
        for(String id : friendsIds){
            org.springframework.social.facebook.api.User user = facebook.userOperations().getUserProfile(id);
            System.out.println(user.getEmail());
            System.out.println(user.getFirstName());
        }

【问题讨论】:

  • 您使用的是不受支持的 SDK 吗?
  • 你只能得到授权你应用的朋友,你知道的,对吧?
  • 我正在使用“org.springframework.social.facebook.api”

标签: spring facebook spring-boot


【解决方案1】:

不可能获得所有朋友,只有那些正在使用您的应用程序的朋友。不,没有解决方法。

通过 /me/friends 端点返回的朋友列表现在仅限于已授权您的应用的朋友列表。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-21
    • 1970-01-01
    • 2015-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多