In the previous recipe, we learned how to log a user in using his/her Facebook account. Now, we will learn how to download more information about the user from Facebook, such as the user's friends.
You can modify the previous recipe's project or duplicate it so that you can keep both versions at hand.
A user's Facebook data can be fetched by carrying out the following steps:
Modify the
signup
method on theFacebookDispatcher
object as follows:def signup(): Box[LiftResponse] = { val scope = ("email" :: "friends_about_me" :: Nil).mkString(",") val fbUrl = :/("www.facebook.com").secure / "dialog" / "oauth" <<? ("client_id", facebookAppId) :: ("redirect_uri", "http://localhost:8080/fb/callback") :: ("scope", scope) :: Nil Full(RedirectResponse(fbUrl.url)) }
Modify the
FacebookData
snippet to look like this:package code.snippet import com.restfb.{Parameter, DefaultFacebookClient} import...