Skip to content

Commit 4bb9440

Browse files
joshbukerCh4s3
authored andcommitted
Hotfix LinkedIn provider (#36)
* Increment version to 0.10.1 * Fix how linkedin provider handles fetching id
1 parent 1e74903 commit 4bb9440

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

lib/sorcery/providers/linkedin.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ def get_consumer
3030
end
3131

3232
def get_user_hash(access_token)
33-
fields = user_info_fields.join(',')
34-
response = access_token.get("#{@user_info_path}:(id,#{fields})", 'x-li-format' => 'json')
33+
# Always include id for provider uid and prevent accidental duplication via setting `user_info_field = ['id']` (needed in Sorcery 0.9.1)
34+
info_fields = user_info_fields ? user_info_fields.reject{|n| n == 'id'} : []
35+
fields = info_fields.any? ? 'id,' + info_fields.join(',') : 'id'
36+
response = access_token.get("#{@user_info_path}:(#{fields})", 'x-li-format' => 'json')
3537

3638
auth_hash(access_token).tap do |h|
3739
h[:user_info] = JSON.parse(response.body)

lib/sorcery/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Sorcery
2-
VERSION = '0.10.0'
2+
VERSION = '0.10.1'
33
end

0 commit comments

Comments
 (0)