Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When connecting to Linkedin with OAuth, is it possible to get the user's non-primary email addresses?

I'm using Devise and the omniauth-linkedin gem to allow users to log into my Rails app with a LinkedIn account (Rails 4.1.8, Devise 3.4.0, omniauth-linkedin 0.2.0). I've had no trouble getting the user's primary email from LinkedIn, but I'm wondering, is it possible to get a list of ALL the emails associated with the user's LinkedIn account, including non-primary emails?

The LinkedIn docs (https://developer.linkedin.com/documents/authentication) don't say how to do this, but they also don't say that it's impossible.

If it IS possible, what scopes/fields do I need to add to my Devise config? Currently the relevant line in config/devise.rb looks like this:

config.omniauth :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'],
    scope: 'r_fullprofile r_emailaddress r_network w_messages',
    fields: ["id", "email-address", "first-name", "last-name", "headline",
             "industry", "picture-url", "public-profile-url", "location",
             "connections"]
like image 721
Dave Urban Avatar asked Oct 20 '22 17:10

Dave Urban


1 Answers

The LinkedIn Profile API does not expose email addresses other than the primary one associated with a member profile.

like image 184
Justin Kominar Avatar answered Nov 15 '22 06:11

Justin Kominar