Dead Simple Integration with LinkedIn's OAuth Authentication with Play! and Java (using Play LinkedIn Module Version 0.2.1)

makes it very easy to build Web applications with Java, it’s Java’s answer to Rails. If you are used to the usual stack of EJB or Spring/Hibernate, Play will feel like instant joy. First of all, it just works, no more hours wasted waiting for your WAR to re-deploy,  trying to get frameworks to talk to each other, it just works; it’s fun to develop Web Applications in Java again!  You won’t waste any time trying to get different frameworks to talk to each other because Play comes with a modules repository and a very easy to use one-command install.

In our example today, we are going to make use of LinkedIn’s OAuth Authentication using Play 1.1.1 and Play’s LinkedIn Module (version 0.2.1) which I just released; This module comes with a sample blog app called Yabe, sample application provided by Play, which I modified to add LinkedIn’s OAuth support.

So let’s get down to business…

1) First you need to setup your environment. Make sure you have your JDK and Play installed. You can download Play 1.1.1 from here or if you are confortable with the command line:

wget http://download.playframework.org/releases/play-1.1.1.zip

unzip play-1.1.1.zip; mv play-1.1.1 $HOME/play-1.1.1

Play’s README file chooses to install under /opt but I prefer to use a home directory because it doesn’t require root or sudo access. Feel free to use /opt if you prefer.

2) Now let’s setup the environment variables:

export PATH=$PATH:$HOME/play-1.1.1

 

3) Install Play’s LinkedIn’s module:

play install linkedin

* If it fails it means the module hasn’t been released to Play’s official repository yet, you can get it from*Github*and unpackage the zip file under $HOME/play/modules/linkedin-0.2.1.*

4) Let’s get a headstart using the sample project I created based on Play’s Yabe sample application. Fork the sample project on Github, it should be under samples-and-tests/yabe.

5) Just run!

cd playframework-linkedin/samples-and-tests/yabe;

play run

You should be able to see it on your http://localhost:9000, have fun!

To find out more about this project, visit http://geeks.aretotally.in/projects/play-framework-linkedin-module.

And feel free to see or fork the source code on https://github.com/feliperazeek/playframework-linkedin.

* Remember to register your own API key with*LinkedIn*before going to production.*