Wednesday, 28 August 2013

Linkedin Gem with Rails 4 : How to Import Linkedin user information to your Rails Application

All your Linkedin Information's are now just a mouse click away. by using linkedin gem with Rails we can easily import all your linkedin information's  like your skills , contact details , experience details, education details , project details , connection details etc. Now almost all popular websites mainly working in the Professional Networking platform are providing this feature ,  is my favorite among them , which does the job very brilliant. 



  gem 'linkedin', '0.4.2', :git => "git://"

Linkedin Controller

As you all know the basic authentication and the Callback methods , here also first it will  authenticate the user with the linkedin app . You can specify the user access information here in the Linkedin Configuration .What all user fields that your application want to get access. After Authenticating the user it will redirect the user back to the callback method with oauth_verifier as parmas. you will be able to create Access token and access token secret by using the linkedin client object that we have created using the response parameter.

Once the linkedin Client object creation is done , you will be able to access all the user information's like contact details , skills , education details , experience details etc , All the profile field information's are available at

LinkedIn is very particular about access to profile fields and you cannot combine multiple fields which requires 2 different type of access. so when you try to get just position details by c.profile(:fields => %w(positions)) it assumes the access of type 'r_basicprofile' whereas educations field require access of type 'r_fullprofile'.so try 2 seperate API calls to retrieve both fields.

"first_name","last_name","headline","positions" available for 'r_basicprofile' member permission,so they can be combined together. but "educations", "three_current_positions", "three_past_positions" , "certifications" etc are available in 'r_fullprofile' . So you have to separate the API calls with respect to the requirements.

Route File

View File 


  1. Is there way to get Linkedin posts

  2. The blog is so interactive and Informative , you should write more blogs like this Ruby on rails Online course