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

Support for picture-urls::(original) and profile picture #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'], :scope => 'r_fu
When specifying which permissions you want to users to grant to your application, you will probably want to specify the array of fields that you want returned in the omniauth hash. The list of default fields is as follows:

```ruby
['id', 'email-address', 'first-name', 'last-name', 'headline', 'location', 'industry', 'picture-url', 'public-profile-url']
['id', 'email-address', 'first-name', 'last-name', 'headline', 'location', 'industry', 'picture-urls::(original)', 'public-profile-url']
```

Here's an example of a possible configuration where the fields returned from the API are: id, email-address, first-name and last-name.
Expand Down
4 changes: 2 additions & 2 deletions lib/omniauth/strategies/linkedin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class LinkedIn < OmniAuth::Strategies::OAuth2
}

option :scope, 'r_basicprofile r_emailaddress'
option :fields, ['id', 'email-address', 'first-name', 'last-name', 'headline', 'location', 'industry', 'picture-url', 'public-profile-url']
option :fields, ['id', 'email-address', 'first-name', 'last-name', 'headline', 'location', 'industry', 'picture-urls::(original)', 'public-profile-url']

# These are called after authentication has succeeded. If
# possible, you should try to set the UID without making
Expand All @@ -33,7 +33,7 @@ class LinkedIn < OmniAuth::Strategies::OAuth2
:last_name => raw_info['lastName'],
:location => raw_info['location'],
:description => raw_info['headline'],
:image => raw_info['pictureUrl'],
:image => raw_info.fetch('pictureUrls', {}).fetch('values', []).first,
:urls => {
'public_profile' => raw_info['publicProfileUrl']
}
Expand Down