To integrate a Sign in with LinkedIn functionality in your social project that is being built with Play 2.2.1, follow these steps ( this post summarizes the work done step by step).
1) Create a LinkedIn app (if you do not have one already)
Follow the link https://developer.linkedin.com/documents/quick-start-guide and create an app. Enter all the details including Site URL . The Site URL could be something like http://www..com (but it should be a valid site’s URL)
Once you have saved this app , you would get a
API Key and secret .
Take a note of this
API Key and secret .
We would use them in our code.
2) If you are using Play, then add the
API Key, secret key & contextURL(callback URL) in application.conf file.
3) Download a LinkedIn login image from linkedin.png, & save it in “public/images” folder of app
4) Add following dependency in build.sbt (or Build.scala for Play 2.1.x or older versions)
“org.scribe” % “scribe” % “1.3.5”
5) Add following to routes file in conf folder
GET /user/linkedin/login controllers.LinkedInController.linkedinLogin
GET /user/linkedin/callback controllers.LinkedInController.linkedinCallback
6) Let us now create LinkedInController.scala to configure API Key , secret key and callbackURL . We would also use this scala file to request access token from LinkedIn .
7) Now let us create a template RedirectMain.scala.html which would show LinkedIn Login Page on clicking LinkedIn login link on login page .
8) Add LinkedIn login link in the login.scala.html.
Hurrah! Finally I got a website from where I be capable of actually obtain valuable data
regarding my study and knowledge.
How can we do without Play ? (just aka http)