omniauth-linkedin-oauth2 0.0.3 → 0.1.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d2c0f9146e300a9cc647e53a54c75abfdde6988
|
4
|
+
data.tar.gz: c7e26797d512f938cd83bd0279e0a710ecbe74eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 081ac395e1819ff2c52948e4a89b9648894e3087a9c8e153c0c228d32715e16fd6adb2f329326bdf4d471a1b2f6db941e7af425edcbf6f638baf76a899b9d091
|
7
|
+
data.tar.gz: 013abfd2808b0fd5c43fa5a1ef44b07da0b915773ca52d4f8470dab27dee4f3ad83050ca63e431f23fa0de88dc212b401b4e70237ff9d9151588df8ac59ca9ee
|
data/README.md
CHANGED
@@ -20,6 +20,12 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
$ gem install omniauth-linkedin-oauth2
|
22
22
|
|
23
|
+
## Upgrading
|
24
|
+
|
25
|
+
Previous versions of this gem used the provider name `:linkedin_oauth2`. In order to provide a cleaner upgrade path for users who were previously using the OAuth 1.0 omniauth adapter for LinkedIn [https://github.com/skorks/omniauth-linkedin], this has been renamed to just `:linkedin`.
|
26
|
+
|
27
|
+
Users who are upgrading from previous versions of this gem may need to update their Omniauth and/or Devise configurations to use the shorter provider name.
|
28
|
+
|
23
29
|
## Usage
|
24
30
|
|
25
31
|
Register your application with LinkedIn to receive an API key: https://www.linkedin.com/secure/developer
|
@@ -28,11 +34,11 @@ This is an example that you might put into a Rails initializer at `config/initia
|
|
28
34
|
|
29
35
|
```ruby
|
30
36
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
31
|
-
provider :
|
37
|
+
provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET']
|
32
38
|
end
|
33
39
|
```
|
34
40
|
|
35
|
-
You can now access the OmniAuth LinkedIn OAuth2 URL: `/auth/
|
41
|
+
You can now access the OmniAuth LinkedIn OAuth2 URL: `/auth/linkedin`.
|
36
42
|
|
37
43
|
## Granting Member Permissions to Your Application
|
38
44
|
|
@@ -46,7 +52,7 @@ By default, omniauth-linkedin-oauth2 requests the following permissions:
|
|
46
52
|
You can configure the scope option:
|
47
53
|
|
48
54
|
```ruby
|
49
|
-
provider :
|
55
|
+
provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'], :scope => 'r_fullprofile r_emailaddress r_network'
|
50
56
|
```
|
51
57
|
|
52
58
|
## Profile Fields
|
@@ -60,7 +66,7 @@ When specifying which permissions you want to users to grant to your application
|
|
60
66
|
Here's an example of a possible configuration where the the fields returned from the API are: id, email-address, first-name and last-name.
|
61
67
|
|
62
68
|
```ruby
|
63
|
-
provider :
|
69
|
+
provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'], :fields => ['id', 'email-address', 'first-name', 'last-name']
|
64
70
|
```
|
65
71
|
|
66
72
|
To see a complete list of available fields, consult the LinkedIn documentation at: https://developer.linkedin.com/documents/profile-fields
|
@@ -1,2 +1,2 @@
|
|
1
1
|
require "omniauth-linkedin-oauth2/version"
|
2
|
-
require "omniauth/strategies/
|
2
|
+
require "omniauth/strategies/linkedin"
|
@@ -2,9 +2,9 @@ require 'omniauth-oauth2'
|
|
2
2
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
|
-
class
|
5
|
+
class LinkedIn < OmniAuth::Strategies::OAuth2
|
6
6
|
# Give your strategy a name.
|
7
|
-
option :name, '
|
7
|
+
option :name, 'linkedin'
|
8
8
|
|
9
9
|
# This is where you pass the options you would pass when
|
10
10
|
# initializing your consumer from the OAuth gem.
|
@@ -67,4 +67,4 @@ module OmniAuth
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
OmniAuth.config.add_camelization '
|
70
|
+
OmniAuth.config.add_camelization 'linkedin', 'LinkedIn'
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'omniauth-linkedin-oauth2'
|
3
3
|
|
4
|
-
describe OmniAuth::Strategies::
|
5
|
-
subject { OmniAuth::Strategies::
|
4
|
+
describe OmniAuth::Strategies::LinkedIn do
|
5
|
+
subject { OmniAuth::Strategies::LinkedIn.new(nil) }
|
6
6
|
|
7
7
|
it 'should add a camelization for itself' do
|
8
|
-
OmniAuth::Utils.camelize('
|
8
|
+
OmniAuth::Utils.camelize('linkedin').should == 'LinkedIn'
|
9
9
|
end
|
10
10
|
|
11
11
|
describe '#client' do
|
@@ -24,7 +24,7 @@ describe OmniAuth::Strategies::LinkedInOAuth2 do
|
|
24
24
|
|
25
25
|
describe '#callback_path' do
|
26
26
|
it 'has the correct callback path' do
|
27
|
-
subject.callback_path.should eq('/auth/
|
27
|
+
subject.callback_path.should eq('/auth/linkedin/callback')
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-linkedin-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Décio Ferreira
|
@@ -112,7 +112,7 @@ files:
|
|
112
112
|
- example/config.ru
|
113
113
|
- lib/omniauth-linkedin-oauth2.rb
|
114
114
|
- lib/omniauth-linkedin-oauth2/version.rb
|
115
|
-
- lib/omniauth/strategies/
|
115
|
+
- lib/omniauth/strategies/linkedin.rb
|
116
116
|
- omniauth-linkedin-oauth2.gemspec
|
117
117
|
- spec/omniauth/strategies/linkedin_oauth2_spec.rb
|
118
118
|
- spec/spec_helper.rb
|