omniauth-linkedin-jsapi 0.1.1 → 0.1.2
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 +8 -8
- data/lib/omniauth-linkedin-jsapi/version.rb +1 -1
- data/lib/omniauth/strategies/linkedin.rb +24 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWY3MmU2ZTEzOTAyOTEzMzAzYjM5NDU2YjhkYTU5YmY2NDMyY2FkNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjBjN2JhNTUzZDI2Y2IzMjFjZGY0NDczZjFhN2RjNDkyYTk0YzhjNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODgzZmZlNGZmZWM2OGQ3NWE3YWQxMjNjNDdjNzVhMzNkMmI2MzljMTYyNDJm
|
10
|
+
ODMxZjc5MmRlMjJiMmE2ZDhlYjdjM2E0M2U2ZjU1OWI4NGQ2YzdjNzQwNzU2
|
11
|
+
MTRmYTk5ODJkZDQ1MmQ4YTNjMDY3MzlhZmQ3Y2QxMzU3ODE0MTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzZjYmFhMzRlZDdkN2RkOGJiNTZmNTlmNDA3MTMzNzNkNmRmODU0YjNhZmYz
|
14
|
+
NGVlOGYzOTg2YjA1ZmE1ZDM2N2MwNjdiNTY5YzlmOGY4ZGNkMzg3Yjg0Y2Nj
|
15
|
+
MWI2OGM2NzEyZjA5NWFkYmI0MWQzYWFkODU4ODk4ZWQ2MmM5MTE=
|
@@ -12,6 +12,7 @@ module OmniAuth
|
|
12
12
|
include OmniAuth::Strategy
|
13
13
|
class NoSecureCookieError < StandardError; end
|
14
14
|
class InvalidSecureCookieError < StandardError; end
|
15
|
+
class LinkedinServerError < StandardError; end
|
15
16
|
|
16
17
|
args [:api_key, :secret_key]
|
17
18
|
|
@@ -60,7 +61,23 @@ module OmniAuth
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def raw_info
|
63
|
-
@raw_info ||=
|
64
|
+
@raw_info ||= lambda do
|
65
|
+
# Add retry logic to user info fetching because sometimes Linkedin gets back with the following data:
|
66
|
+
# raw_info: {
|
67
|
+
# errorCode: 0,
|
68
|
+
# message: "Could not find person based on: ~",
|
69
|
+
# requestId: "***************",
|
70
|
+
# status: 404,
|
71
|
+
# timestamp: 1393490622830.0
|
72
|
+
# }
|
73
|
+
try_count = 0
|
74
|
+
begin
|
75
|
+
raw_info = MultiJson.decode(access_token.get("/v1/people/~:(#{options.fields.join(',')})?format=json").body)
|
76
|
+
try_count += 1
|
77
|
+
end while raw_info['errorCode'].present? and try_count < 5
|
78
|
+
raise LinkedinServerError, raw_info['message'] if raw_info['errorCode'].present?
|
79
|
+
raw_info
|
80
|
+
end.call
|
64
81
|
end
|
65
82
|
|
66
83
|
attr_accessor :access_token
|
@@ -86,6 +103,12 @@ module OmniAuth
|
|
86
103
|
else
|
87
104
|
raise NoSecureCookieError, 'must pass a `linkedin_oauth_XXX` cookie'
|
88
105
|
end
|
106
|
+
rescue NoSecureCookieError => e
|
107
|
+
fail!(:invalid_credentials, e)
|
108
|
+
rescue InvalidSecureCookieError => e
|
109
|
+
fail!(:invalid_credentials, e)
|
110
|
+
rescue LinkedinServerError => e
|
111
|
+
fail!(:invalid_response, e)
|
89
112
|
rescue ::Timeout::Error => e
|
90
113
|
fail!(:timeout, e)
|
91
114
|
rescue ::Net::HTTPFatalError, ::OpenSSL::SSL::SSLError => e
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-linkedin-jsapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Gong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|