omniauth-hubspot 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth/hubspot/version.rb +1 -1
- data/lib/omniauth/strategies/hubspot.rb +24 -20
- data/omniauth-hubspot.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff582e0a2ff6a180336b6998b1c7441cc08ba30f
|
4
|
+
data.tar.gz: 440cc99e40a4e0240c76ca833cebbc4c7f4bd541
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acda4f00c15d095d5ab33e61bc45462234a0945ce23d777987cd18ce0da76b617c7f38ad580344eddc9bee6b389b80f569c539b2b6f6cc5b0613a69b58573b90
|
7
|
+
data.tar.gz: f27983b51d507be593a6898c8980e65e0f2173f390e0ebb0f4f3bd7c3d9c80fe73a40f7e815b95155d5c0576783f1f26489aa5d344602ea2f74fe023a68226a6
|
@@ -1,46 +1,50 @@
|
|
1
|
-
require 'omniauth-
|
1
|
+
require 'omniauth-oauth2'
|
2
2
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
|
-
class HubSpot < OmniAuth::Strategies::
|
5
|
+
class HubSpot < OmniAuth::Strategies::OAuth2
|
6
6
|
|
7
7
|
args [:client_id]
|
8
8
|
|
9
9
|
option :name, "hubspot"
|
10
|
+
option :provider_ignores_state, true
|
10
11
|
|
11
12
|
option :client_options, {
|
12
13
|
:site => 'https://app.hubspot.com',
|
13
14
|
:authorize_url => '/auth/authenticate'
|
14
15
|
}
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
option :authorize_options, [:scope, :portalId]
|
18
|
+
|
19
|
+
attr_accessor :refresh_token
|
20
|
+
attr_accessor :expires_in
|
18
21
|
|
19
|
-
|
20
|
-
if
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
def callback_phase
|
23
|
+
if request.params['error'] || request.params['error_reason']
|
24
|
+
raise CallbackError.new(request.params['error'], request.params['error_description'] || request.params['error_reason'], request.params['error_uri'])
|
25
|
+
end
|
26
|
+
if !options.provider_ignores_state && (request.params['state'].to_s.empty? || request.params['state'] != session.delete('omniauth.state'))
|
27
|
+
raise CallbackError.new(nil, :csrf_detected)
|
24
28
|
end
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
@expires_in = params[:expires_in]
|
30
|
+
self.access_token = params[:access_token]
|
31
|
+
|
29
32
|
super
|
30
|
-
rescue ::
|
31
|
-
fail!(:timeout, e)
|
32
|
-
rescue ::Net::HTTPFatalError, ::OpenSSL::SSL::SSLError => e
|
33
|
-
fail!(:service_unavailable, e)
|
34
|
-
rescue ::OAuth::Unauthorized => e
|
33
|
+
rescue ::OAuth2::Error, CallbackError => e
|
35
34
|
fail!(:invalid_credentials, e)
|
36
35
|
rescue ::MultiJson::DecodeError => e
|
37
36
|
fail!(:invalid_response, e)
|
38
|
-
rescue ::
|
39
|
-
fail!(:
|
37
|
+
rescue ::Timeout::Error, ::Errno::ETIMEDOUT, Faraday::Error::TimeoutError => e
|
38
|
+
fail!(:timeout, e)
|
39
|
+
rescue ::SocketError, Faraday::Error::ConnectionFailed => e
|
40
|
+
fail!(:failed_to_connect, e)
|
40
41
|
end
|
41
42
|
|
42
43
|
credentials do
|
43
|
-
{'
|
44
|
+
hash = {'token' => access_token}
|
45
|
+
hash.merge!('refresh_token' => refresh_token)
|
46
|
+
hash.merge!('expires_in' => expires_in)
|
47
|
+
hash
|
44
48
|
end
|
45
49
|
|
46
50
|
end
|
data/omniauth-hubspot.gemspec
CHANGED
@@ -3,8 +3,8 @@ require File.expand_path('../lib/omniauth/hubspot/version', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.add_dependency 'omniauth'
|
6
|
-
gem.add_dependency '
|
7
|
-
gem.add_dependency 'omniauth-
|
6
|
+
gem.add_dependency 'oauth2'
|
7
|
+
gem.add_dependency 'omniauth-oauth2'
|
8
8
|
|
9
9
|
gem.add_development_dependency 'rspec', '~> 2.7'
|
10
10
|
gem.add_development_dependency 'rack-test'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-hubspot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Arnold
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: oauth2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: omniauth-
|
42
|
+
name: omniauth-oauth2
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '>='
|