In this recipe, we will see how to log a user in to your application using his/her Facebook account.
Before being able to integrate our application with Facebook, we need to register an application on Facebook. This will give us an application identification and a secret token that will be used to identify the application requesting authorization and access to the user's data.
Start a new blank project.
Edit the
build.sbt
file by adding the following dependencies:"net.databinder.dispatch" %% "dispatch-core" % "0.11.0", "com.restfb" % "restfb" % "1.6.12"
Create a new app on Facebook and add its
id
andsecret
keys in thedefault.props
file:facebook.app.id=<app-id> facebook.app.secret=<app-secret>
Note
To learn how to register an application on Facebook, please navigate to this URL: https://developers.facebook.com/docs/web/tutorials/scrumptious/register-facebook-application/.