Play Framework Module to do OAuth Authentication with LinkedIn. Sample App:
Java Python
Latest commit 48ce60d Mar 8, 2011 Felipe Oliveira adding CHANGE file

Play Framework - Module play-linkedin 0.2.1

by Felipe Oliveira

Easily integrate LinkedIn's OAuth authentication into any Java web application using the super cool Play Framework (


Register your application with LinkedIn ( LinkedIn's API documentation can be found at

Install the module

Install the linkedin module from the modules repository:

play install linkedin

Enable the module

After installing the module, add the following to your application.conf to enable it:


Configure the module

And finally, you need to configure the module by setting these properties in your application.conf (Register API Key at


All of the properties are required.


Step-by-Step Tutorial can be found at

Use the linkedin.button tag in your view

The linkedin.button tag outputs a link that will prompt your users to authenticate with LinkedIn when it is clicked.

#{linkedin.button /}

Define your OAuth callback

Your linkedin.model class needs to implement a static method called @linkedinOAuthCallback@. After a user has authenticated using LinkedIn, the module will call this method with a token (String). This is your opportunity to add the user to your database, add the user to your session, or do anything else you want.

        public static User findByLinkedInId(String linkedInId) {
            return find("byLinkedInId", linkedInId).first();

        public static void linkedinOAuthCallback(play.modules.linkedin.LinkedInProfile profile) {
  "Handle LinkedIn OAuth Callback: " + profile);
            User user = findByLinkedInId(profile.getId());
            String username = "linkedin:" + profile.getId();
            if(user == null || user.linkedInToken == null) {
                user = new User();
                user.fullname = (new StringBuffer().append(profile.getFirstName()).append(" ").append(profile.getLastName())).toString();
                user.linkedInId = profile.getId();
                user.industry = profile.getIndustry();
                user.headline = profile.getHeadline();
                user.pictureUrl = profile.getPictureUrl();
                user.linkedInToken = profile.getAccessToken();
                user.isAdmin = true;
                user =;
            } else {
      "Found User: " + user);
                user.linkedInToken = profile.getAccessToken();
            if ( user == null ) {
                throw new RuntimeException("Could not store or lookup user with LinkedIn Profile: " + profile);
            Session.current().put("username", username);

Source Code

Fork it on Github