Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r_fullprofile not fetching all the details. #19

Open
shivakumaarmgs opened this issue Apr 1, 2014 · 2 comments
Open

r_fullprofile not fetching all the details. #19

shivakumaarmgs opened this issue Apr 1, 2014 · 2 comments

Comments

@shivakumaarmgs
Copy link

I have been using this gem quite a long time. I have never tweaked around the :scope. But now I wanted to get certifications from linkedin and tired the steps given in read me though its not working.

#config/initializers/omniauth.rb
provider :linkedin, '**************' , *******************', :scope => 'r_fullprofile'

the auth hash returned from linkedin

<OmniAuth::AuthHash credentials=#<OmniAuth::AuthHash expires=true expires_at=1401539399 token="AQVSUdXiNCHUMHlG0hV_Fp8uSJ0W6-kU4XB5JeWS8kO6ksPirijaF9sb5qH*************************************************************************"> extra=#<OmniAuth::AuthHash raw_info=#<OmniAuth::AuthHash firstName="*******************r" headline="************************" id="************" industry="Computer Software" lastName="**********" location=#<OmniAuth::AuthHash country=#<OmniAuth::AuthHash code="in"> name="Chennai Area, India"> pictureUrl="http://m.c.lnkd.licdn.com/mpr/mprx/********************************" publicProfileUrl="http://www.linkedin.com/in/****************************">> info=#<OmniAuth::AuthHash::InfoHash description="********************" email=nil first_name="**********************r" image="http://m.c.lnkd.licdn.com/mpr/mprx/**********************************************************************" last_name="*******" location=#<OmniAuth::AuthHash country=#<OmniAuth::AuthHash code="in"> name="Chennai Area, India"> name="Shivakumaar MGS" nickname="Shivakumaar MGS" urls=#<OmniAuth::AuthHash public_profile="http://www.linkedin.com/in/***************">> provider="linkedin" uid="************">

It doesn't contain any full profile fields as given in https://developer.linkedin.com/documents/profile-fields#profile

@QuillyT
Copy link

QuillyT commented Apr 5, 2014

I'm still trying to figure out LinkedIn authentication for omniauth as well and this is probably a bunch of extraneous steps but if nothing else works...
I was able to use this gem https://github.com/acvwilson/linkedin-oauth2 to pull data from the full profile with the LinkedIn API.

I just took that token from the auth hash and stuck it in here.. (based off the linkedin-oauth2 readme)

linkedin_client = LinkedIn::Client.new('your_consumer_key', 'your_consumer_secret')
linkedin_client.authorize_from_access(TOKEN_FROM_THE_AUTH_HASH)
linkedin_client.profile( fields: 'first-name last-name maiden-name formatted-name... ' )

...and it gives me all the fields!

Please share if you find a better solution than this :)

@rschooley
Copy link

For anyone else running into this, the issue is the whitelist of fields set here:
https://github.com/decioferreira/omniauth-linkedin-oauth2/blob/master/lib/omniauth/strategies/linkedin.rb#L18

I was trying to get positions, which should be returned by r_basicprofile

I ended up adding positions to fields in the devise config:

config.omniauth :linkedin, 
  ENV["LINKEDIN_CLIENT_ID"], 
  ENV["LINKEDIN_CLIENT_SECRET"],
  scope: 'r_basicprofile r_emailaddress', 
  fields: ['id', 'email-address', 'first-name', 'last-name', 'headline', 'location', 'industry', 'picture-url', 'public-profile-url', 'positions']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants