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:
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"]
: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
Here is a list of all the available fields.
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.