9

LinkedIn recently changed their API to require that third parties be more explicit in what information they request. In order to access a user's past employment history and education with omniauth, you must pass the r_fullprofile permission token (before, you did not have to make a specific request for past employment or education data). To access a user's email address, you need to pass the r_emailaddress permission token. Before anyone asks, I am using a new LinkedIn API key (old keys are not affected by recent changes).

The omniauth-linkedin gem was updated recently to account for LinkedIn's permission changes, but I am still having issues passing this new scope parameter through all portions of the authentication flow. I am following the instructions provided in the omniauth-linkedin readme to create my config/omniauth.rb file:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'], 
  :scope => 'r_fullprofile,r_emailaddress', :fields => ['id', 'email-address', 'first-name', 'last-name', 'headline', 'industry', 'picture-url', 'public-profile-url', 'location', 'positions']
end

The scope seems to pass successfully through the first part of authentication, visible in the first screenshot below (YOUR FULL PROFILE...YOUR EMAIL ADDRESS):

authentication_first_step

However, after the user enters their credentials, the scope seems to be lost and only the default 'YOUR PROFILE OVERVIEW' fields are transferred:

enter image description here

Very stuck on this and could really use some help because I need full profile and education data for my users. Let me know if I need to provide my auth_controller code. Thank you.

po.studio
  • 4,007
  • 5
  • 25
  • 37

0 Answers0