omniauth-streamlabs 0.1.0 → 0.2.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 +4 -4
- data/lib/omniauth/strategies/streamlabs.rb +59 -0
- data/lib/omniauth/streamlabs/version.rb +1 -1
- data/lib/omniauth-streamlabs.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efc3e2d0ab4e64c225d4f77ed8432331e35b5b79
|
4
|
+
data.tar.gz: a1c53c61be87b9db4e23710e989a2f6f02dc4375
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4911d9ba97994da9366fd079f9997d0a7575fc34a488a93db82acfd197ebddce327b427408f0ac56d2aa98e3ff97a895736f618bdcd265984c5ca92d9fdcc9d9
|
7
|
+
data.tar.gz: ba64ce507488bbcf03d1e6d2144f79511e4662bec8cc49539d23cf802a7672d374fb1e39e6d7a068db9fcf3173f32a25b33cc711ca543eeb0bebbf9167c4953d
|
@@ -3,6 +3,65 @@ require 'omniauth-oauth2'
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
5
|
class Streamlabs < OmniAuth::Strategies::OAuth2
|
6
|
+
DEFAULT_SCOPE = 'donations.read'
|
7
|
+
|
8
|
+
option :name, "streamlabs"
|
9
|
+
|
10
|
+
option :client_options, {
|
11
|
+
site: 'https://streamlabs.com',
|
12
|
+
authorize_url: '/api/v1.0/authorize',
|
13
|
+
token_url: '/api/v1.0/token'
|
14
|
+
}
|
15
|
+
|
16
|
+
option :access_token_options, {
|
17
|
+
header_format: 'Bearer %s',
|
18
|
+
param_name: 'access_token'
|
19
|
+
}
|
20
|
+
|
21
|
+
option :authorize_options, [:scope]
|
22
|
+
|
23
|
+
uid{ raw_info['twitch']['id'] }
|
24
|
+
|
25
|
+
info do
|
26
|
+
{
|
27
|
+
display_name: raw_info['twitch']['display_name'],
|
28
|
+
name: raw_info['twitch']['name']
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
extra do
|
33
|
+
{
|
34
|
+
raw_info: raw_info
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def raw_info
|
39
|
+
@raw_info ||= access_token.get('/api/v1.0/user').parsed
|
40
|
+
end
|
41
|
+
|
42
|
+
def build_access_token
|
43
|
+
super.tap do |token|
|
44
|
+
token.options.merge!(access_token_options)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def access_token_options
|
49
|
+
options.access_token_options.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }
|
50
|
+
end
|
51
|
+
|
52
|
+
def callback_url
|
53
|
+
return options[:redirect_uri] unless options[:redirect_uri].nil?
|
54
|
+
full_host + script_name + callback_path
|
55
|
+
end
|
56
|
+
|
57
|
+
def authorize_params
|
58
|
+
super.tap do |params|
|
59
|
+
options[:authorize_options].each do |k|
|
60
|
+
params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
|
61
|
+
end
|
62
|
+
params[:scope] = params[:scope] || DEFAULT_SCOPE
|
63
|
+
end
|
64
|
+
end
|
6
65
|
end
|
7
66
|
end
|
8
67
|
end
|
data/lib/omniauth-streamlabs.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "omniauth/streamlabs
|
1
|
+
require "omniauth/streamlabs"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-streamlabs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Rohrer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|