omniauth-linkedin-oauth2 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -7
- data/lib/omniauth/strategies/linkedin.rb +9 -8
- data/lib/omniauth-linkedin-oauth2/version.rb +1 -1
- data/spec/omniauth/strategies/linkedin_spec.rb +21 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 151e59afd7380045ce96e463e9e1a2c1b859446bd3f4388e73a40755f9f0a07c
|
4
|
+
data.tar.gz: 3c43667e50b9ab164dfff8e00259331ec2f201c33385d41043c4f2f25da1e3cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da37ff1ca12ada1946a7138b21fac9decf6421fc947563d4a2a0918582472cde222dd4c03edb8ad8426c762088b7f3fef5d08ce35c199497d134c5d3a8d9c4a4
|
7
|
+
data.tar.gz: a76483fc87800753f8d39b281e38822ab04535530fb60e3c83aa2110c6f7926e33984b49d1b83871af9306676c2ee2ba509100f21657c9750f4a8dc3e39c3e09
|
data/README.md
CHANGED
@@ -8,13 +8,9 @@ For more details, read the LinkedIn documentation: https://developer.linkedin.co
|
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
Add this
|
11
|
+
Add this gem to your application's Gemfile:
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
13
|
+
bundle add omniauth-linkedin-oauth2
|
18
14
|
|
19
15
|
Or install it yourself as:
|
20
16
|
|
@@ -54,7 +50,7 @@ By default, omniauth-linkedin-oauth2 requests the following permissions:
|
|
54
50
|
You can configure the scope option:
|
55
51
|
|
56
52
|
```ruby
|
57
|
-
provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'], :scope => '
|
53
|
+
provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'], :scope => 'r_liteprofile'
|
58
54
|
```
|
59
55
|
|
60
56
|
## Profile Fields
|
@@ -42,7 +42,8 @@ module OmniAuth
|
|
42
42
|
def access_token
|
43
43
|
::OAuth2::AccessToken.new(client, oauth2_access_token.token, {
|
44
44
|
:expires_in => oauth2_access_token.expires_in,
|
45
|
-
:expires_at => oauth2_access_token.expires_at
|
45
|
+
:expires_at => oauth2_access_token.expires_at,
|
46
|
+
:refresh_token => oauth2_access_token.refresh_token
|
46
47
|
})
|
47
48
|
end
|
48
49
|
|
@@ -92,9 +93,7 @@ module OmniAuth
|
|
92
93
|
end
|
93
94
|
|
94
95
|
def localized_field field_name
|
95
|
-
|
96
|
-
|
97
|
-
raw_info[field_name]['localized'][field_locale(field_name)]
|
96
|
+
raw_info.dig(*[field_name, 'localized', field_locale(field_name)])
|
98
97
|
end
|
99
98
|
|
100
99
|
def field_locale field_name
|
@@ -102,10 +101,6 @@ module OmniAuth
|
|
102
101
|
"#{ raw_info[field_name]['preferredLocale']['country'] }"
|
103
102
|
end
|
104
103
|
|
105
|
-
def localized_field_available? field_name
|
106
|
-
raw_info[field_name] && raw_info[field_name]['localized']
|
107
|
-
end
|
108
|
-
|
109
104
|
def picture_url
|
110
105
|
return unless picture_available?
|
111
106
|
|
@@ -129,6 +124,12 @@ module OmniAuth
|
|
129
124
|
def profile_endpoint
|
130
125
|
"/v2/me?projection=(#{ fields.join(',') })"
|
131
126
|
end
|
127
|
+
|
128
|
+
def token_params
|
129
|
+
super.tap do |params|
|
130
|
+
params.client_secret = options.client_secret
|
131
|
+
end
|
132
|
+
end
|
132
133
|
end
|
133
134
|
end
|
134
135
|
end
|
@@ -85,9 +85,10 @@ describe OmniAuth::Strategies::LinkedIn do
|
|
85
85
|
let(:expires_in) { 3600 }
|
86
86
|
let(:expires_at) { 946688400 }
|
87
87
|
let(:token) { 'token' }
|
88
|
+
let(:refresh_token) { 'refresh_token' }
|
88
89
|
let(:access_token) do
|
89
90
|
instance_double OAuth2::AccessToken, :expires_in => expires_in,
|
90
|
-
:expires_at => expires_at, :token => token
|
91
|
+
:expires_at => expires_at, :token => token, :refresh_token => refresh_token
|
91
92
|
end
|
92
93
|
|
93
94
|
before :each do
|
@@ -109,4 +110,23 @@ describe OmniAuth::Strategies::LinkedIn do
|
|
109
110
|
end
|
110
111
|
end
|
111
112
|
end
|
113
|
+
|
114
|
+
describe '#localized_field' do
|
115
|
+
let(:raw_info) do
|
116
|
+
{
|
117
|
+
'foo' => {
|
118
|
+
'preferredLocale' => {
|
119
|
+
'language' => 'bar',
|
120
|
+
'country' => 'BAZ'
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
end
|
125
|
+
|
126
|
+
before :each do
|
127
|
+
allow(subject).to receive(:raw_info).and_return raw_info
|
128
|
+
end
|
129
|
+
|
130
|
+
specify { expect(subject.send(:field_locale,'foo')).to eq 'bar_BAZ' }
|
131
|
+
end
|
112
132
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-linkedin-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Décio Ferreira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -106,7 +106,7 @@ homepage: https://github.com/decioferreira/omniauth-linkedin-oauth2
|
|
106
106
|
licenses:
|
107
107
|
- MIT
|
108
108
|
metadata: {}
|
109
|
-
post_install_message:
|
109
|
+
post_install_message:
|
110
110
|
rdoc_options: []
|
111
111
|
require_paths:
|
112
112
|
- lib
|
@@ -121,8 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
125
|
-
signing_key:
|
124
|
+
rubygems_version: 3.2.22
|
125
|
+
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: A LinkedIn OAuth2 strategy for OmniAuth.
|
128
128
|
test_files:
|