9

So I am using omniauth and devise for LinkedIn authentication in my Rails 5 app.

omniauth-linkedin-oauth2 (0.2.5)
devise (4.4.1)

Everything is working great for the most part and users are able to signup and authenticate using LinkedIn. However the default image that is returned in "auth.info.image" is 50x50 which is too small. I've done a lot of reading on this and the suggested way forward is adding "picture-urls::(original)" to the devise fields list. This is consistent with what I see in the documentation (https://developer.linkedin.com/docs/fields/basic-profile). This however does not seem to work and I'm wondering if there is a bug or if this is somehow outdated information.

My devise.rb omniauth config looks like:

config.omniauth Rails.application.config.omniauth, app_key, app_secret],
scope: 'r_basicprofile r_emailaddress',
fields: %w(id email-address first-name last-name picture-url picture-urls::(original))

Even after specifying these fields however, no values are returned in picture urls.

 self.remote_photo_url = auth.extra.raw_info.pictureUrls['values'].first

I've inspected the data that is returned and it's no where to be found. Not sure what I could be missing but any advice would be greatly appreciated!

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
Ian Shields
  • 177
  • 2
  • 8
  • Have you tried inspecting the auth hash? – max Mar 01 '18 at 15:16
  • Yes - I'm able to retrieve everything else including "picture-url" but that is the 50x50 img. There are no other image urls in the hash. I'm honestly curious if something has changed on LinkedIn's end recently. If someone has this working currently it would prove that theory wrong. – Ian Shields Mar 01 '18 at 18:30
  • 1
    Same issue here! – Abram Mar 02 '18 at 18:51
  • 1
    I'm experiencing the complete opposite of your issue. I used to get both `picture-url` which is the smaller, processed image and the `picture-urls` which is the original size image. In the last few days, I've been getting only the larger `picture-urls` but not the smaller `picture-url`. I hope this is a temporary issue and will disappear. – Sam Mar 04 '18 at 02:52
  • 1
    Sam, maybe they set the default to the larger image? – Abram Mar 05 '18 at 01:57
  • 1
    I’m not receiving any picture-urls at all so I don’t think it’s a default thing. – Ian Shields Mar 05 '18 at 12:25
  • Anyone make any progress on this? – Ian Shields Mar 09 '18 at 20:57

1 Answers1

5

I've been importing photos with the 'picture-urls::(original)' field for years but since 2018/2/26 about half of profiles have not been returning this field and since 2018/3/1 none of them have been returning it.

There's no API status available that I'm aware of. I've experienced many LinkedIn API issues that have lasted 2-3 days and then mysteriously disappear. This is an unusually long one though.

Ben
  • 917
  • 9
  • 14