omniauth-proz 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth/proz/version.rb +1 -1
- data/lib/omniauth/strategies/proz.rb +18 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 519e81141220c530c71ea5542c0ce01aa0e6d68a
|
4
|
+
data.tar.gz: ce1f29c10305691147b762660ba12fbe76c3fedc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f0bfd77fdb98362dea43a1b96f9533212e8475949e9092659eef27423f681d6fae2dbb9fb8d4e72c8dd7212d4cce8038cab8b2d5e803259f228214e96fa5548
|
7
|
+
data.tar.gz: d7c4c50c917d9c4508158d4ac1f5dca17e8fe4ddbbc50db5f24aa85e1ea5f5241024d620519c9fda4536ae61f7fb7b70885522d26af185406caaf0611a1e7e1d
|
@@ -4,6 +4,8 @@ module OmniAuth
|
|
4
4
|
module Strategies
|
5
5
|
class Proz < OmniAuth::Strategies::OAuth2
|
6
6
|
|
7
|
+
DEFAULT_SCOPE = 'user.email'
|
8
|
+
|
7
9
|
option :name, :proz
|
8
10
|
|
9
11
|
option :client_options, {
|
@@ -12,6 +14,8 @@ module OmniAuth
|
|
12
14
|
:token_url => '/oauth/token'
|
13
15
|
}
|
14
16
|
|
17
|
+
option :authorize_options, [:scope]
|
18
|
+
|
15
19
|
uid { raw_info['uuid'] }
|
16
20
|
|
17
21
|
info do
|
@@ -23,18 +27,30 @@ module OmniAuth
|
|
23
27
|
end
|
24
28
|
|
25
29
|
def raw_info
|
26
|
-
puts "Get Raw Info"
|
27
30
|
@raw_info ||= access_token.get('https://api.proz.com/v2/user').parsed
|
28
31
|
end
|
29
32
|
|
33
|
+
def authorize_params
|
34
|
+
super.tap do |params|
|
35
|
+
%w[scope].each do |v|
|
36
|
+
if request.params[v]
|
37
|
+
params[v.to_sym] = request.params[v]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
params[:scope] ||= DEFAULT_SCOPE
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
30
45
|
protected
|
46
|
+
|
31
47
|
def build_access_token
|
32
48
|
params = {
|
33
49
|
'client_id' => client.id,
|
34
50
|
'client_secret' => client.secret,
|
35
51
|
'code' => request.params['code'],
|
36
52
|
'grant_type' => 'authorization_code',
|
37
|
-
'redirect_uri' =>
|
53
|
+
'redirect_uri' => options[:callback_url]
|
38
54
|
}.merge(token_params.to_hash(symbolize_keys: true))
|
39
55
|
client.get_token(params, deep_symbolize(options.auth_token_params))
|
40
56
|
end
|