2

I'm using omniauth-linkedin gem in Rails and trying to get data from 'r_fullprofile' and 'r_network'.

In omniauth.rb:

  provider :linkedin, 'consumer_key', 'consumer_secret', 
       :scope => 'r_fullprofile r_emailaddress r_network', 
       :fields => ["id", "email-address", "first-name", "last-name", 
                   "headline", "industry", "picture-url", "public-profile-url", 
                   "location", "connections", "skills", "date-of-birth", "phone-numbers",        
                   "educations", "three-current-positions" ]

In controller:

render :text => request.env["omniauth.auth"].to_yaml

The resultant output seems only to have data for 'r_basicprofile'. How can I obtain for parsing the rest of the desired data (e.g. "connections", "skills", "educations")?

bernie
  • 109
  • 1
  • 9

2 Answers2

0

I was having the same problem with using Omniauth from Devise.

I had to make a change to put the :fields => [...] in to curly braces.

In your case:

  provider :linkedin, 'consumer_key', 'consumer_secret', 
       {:scope => 'r_fullprofile r_emailaddress r_network', 
       :fields => ["id", "email-address", "first-name", "last-name", 
                   "headline", "industry", "picture-url", "public-profile-url", 
                   "location", "connections", "skills", "date-of-birth", "phone-numbers",        
                   "educations", "three-current-positions" ]}

Hope this helps.

Sumit
  • 71
  • 1
  • 5
0

Don't know if this will help you but now some fields have a different name. I put this on my devise.rb and it works:

config.omniauth :linkedin, ENV['OAUTH_LINKEDIN_ID'], ENV['OAUTH_LINKEDIN_SECRET'],
fields: %w(id email-address first-name last-name headline industry picture-url public-profile-url location num-connections), image_size: {height: 1600}

connections is now num-connections, see Linkedin Documentation

  • can you please have a look at http://stackoverflow.com/questions/33849520/how-to-fetch-linkedin-user-data – Amit Pal Nov 24 '15 at 10:10