Providing a “Sign-in with Facebook” functionality using Scala

Recently we have integrated “Sign in with Facebook ” functionality in one of our social project that we are building with Lift 2.4 . This post summarizes the work done step by step.

1) Create a Facebook App (if you do not have one already)

Follow the link https://developers.facebook.com/apps and create an app. Enter all the details including Site URL . The Site URL could be something like http://www..com/api/facebook/auth.

Facebook would send response on this Site URL . Once you would save this apps , you would get a
App ID/API Key and secret .

Take a note of this
App ID/API Key and secret .
We would use them in our code.

2) If you are using Lift, then add the
App ID/API Key and secret key in your default.props.

3) Download a Facebook login image from fb.png .

4) Let us now create FacebookGraph.scala to configure App ID/API Key , secret key and callbackURL . We would also use this scala file to request access token from Facebook .

5) Now let us create Facebok snippet to show Facebook login link on the login page .

6) Add Facebook login link in the login.html.

7) Now let us create Facebook Connect Menu in your SiteMap.scala .

8) Finally create Facebook.api to get response from Facebook .

Written by 

Ayush is the Sr. Lead Consultant @ Knoldus Software LLP. In his 10 years of experience he has become a developer with proven experience in architecting and developing web applications. Ayush has a Masters in Computer Application from U.P. Technical University, Ayush is a strong-willed and self-motivated professional who takes deep care in adhering to quality norms within projects. He is capable of managing challenging projects with remarkable deadline sensitivity without compromising code quality.

8 thoughts on “Providing a “Sign-in with Facebook” functionality using Scala

  1. Hello
    Very interesting your post
    I’m doing my thesis project and I need some of your code
    Try to compile it but some files are missing
    Can you help with the missing files?

    Really I am very interested

  2. Hey Nayli ,

    We have given a basic idea to implement Facebook functioanlity.
    Is your project based on Scala and Lift ?
    Could you please write here error log , which you are getting while compilation .

Leave a Reply

%d bloggers like this: