May 2015
Intermediate to advanced
234 pages
4h 18m
English
In this recipe, you'll learn how to retrieve the friends list of a Facebook user from a Spring web application.
This recipe uses the code from the Connecting to Facebook recipe.
Here are the steps to retrieve the list of friends of a Facebook user:
FacebookController class, in the login() method, add user_friends to the scope parameter: params.setScope("public_profile, user_friends");Model argument to the fb() method:@RequestMapping("/fb")
public String fb(HttpServletRequest request, Model model) {
...if(facebook.isAuthorized()) block, use the Facebook object to get the list of friends:List<Reference> friendList = facebook.friendOperations().getFriends(); ...
Read now
Unlock full access