Ryan did a detailed tutorial on using Omniauth. What I put here is several things to pay attention to when you work with Linkedin.
Gems to work with Omniauth and Linkedin:
gem 'omniauth' gem 'omniauth-linkedin'
So basically, all the info that you want to retrieve from the user's Linkedin account should be put in
Rails.application.config.middleware.use OmniAuth::Builder do provider :linked_in, "XXX", "XXX", :scope => "r_basicprofile r_emailaddress", :field => ["id", "email-address"] end
:field</code> is where you tell Omniauth what to get from Linkedin, such things as:
"first-name", "last-name", "headline", "picture-url", "public-profile-url
The latest update of Omniauth doesn't use
hash['user_info']['name']</code> anymore, but hash['info']['name']</code>.
Also, the retrieved URL from Linkedin public profile is kinda not friendly.
--- !ruby/hash:Hashie::Mashpublic_profile: http://linkedin.com/in/user
I have filed an issue here so that the gem creator can fix it. For this meanwhile let's make do with this solution:
Check out this gist if you're confused where to put this code.