omniauth-twitch 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -0
- data/lib/omniauth/strategies/twitch.rb +10 -6
- data/lib/omniauth/twitch/version.rb +1 -1
- data/omniauth-twitch.gemspec +2 -2
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6b35e14f39c1812e034b5b6d1594466365105d8
|
4
|
+
data.tar.gz: bcffeb8465aa84ae179e28fde8d21d2d7cd17ed4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25ff8352e0de7328c82cbc479db44bd248395be766299eae5249760192a019da12766a89402b69e77e02d22297bebd99e1443f07bbf9fb6e704cdbc38c6a4115
|
7
|
+
data.tar.gz: 10ac5ae232b3f56539266fca117cd85fb01f1377381b2479c9ea1470a184aca2b975f67bc1d99fdd0214007716a7586d2048bd4c3f031c354d96bea521e8fe79
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/omniauth-twitch.svg)](http://badge.fury.io/rb/omniauth-twitch)
|
2
|
+
|
1
3
|
# OmniAuth::Twitch
|
2
4
|
|
3
5
|
A OmniAuth strategy for Twitch
|
@@ -25,3 +27,40 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
25
27
|
provider :twitch, ENV["TWITCH_CLIENT_ID"], ENV["TWITCH_CLIENT_SECRET"]
|
26
28
|
end
|
27
29
|
```
|
30
|
+
|
31
|
+
## Auth Hash
|
32
|
+
|
33
|
+
Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
{
|
37
|
+
provider: 'twitch',
|
38
|
+
uid: 12345678,
|
39
|
+
info: {
|
40
|
+
name: 'JohnDoe',
|
41
|
+
email: 'johndoe@gmail.com',
|
42
|
+
nickname: 'johndoe',
|
43
|
+
description: 'My channel.',
|
44
|
+
image: 'http://static-cdn.jtvnw.net/jtv-static/404_preview-300x300.png',
|
45
|
+
},
|
46
|
+
credentials: {
|
47
|
+
token: 'asdfghjklasdfghjklasdfghjkl', # OAuth 2.0 access_token, which you may wish to store
|
48
|
+
expires: false # this will always be false
|
49
|
+
},
|
50
|
+
extra: {
|
51
|
+
raw_info: {
|
52
|
+
display_name: 'JohnDoe',
|
53
|
+
_id: 12345678,
|
54
|
+
name: 'johndoe',
|
55
|
+
type: 'user',
|
56
|
+
bio:"My channel.",
|
57
|
+
created_at:"2011-07-01T19:46:21Z",
|
58
|
+
updated_at:"2014-05-06T05:59:37Z",
|
59
|
+
logo:nil,
|
60
|
+
_links: { self: 'https://api.twitch.tv/kraken/users/johndoe'},
|
61
|
+
email:'johdoe@gmail.com',
|
62
|
+
partnered:false
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
```
|
@@ -24,12 +24,12 @@ module OmniAuth
|
|
24
24
|
|
25
25
|
info do
|
26
26
|
{
|
27
|
-
|
28
|
-
name: raw_info['name'],
|
27
|
+
name: raw_info['display_name'],
|
29
28
|
email: raw_info['email'],
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
nickname: raw_info['name'],
|
30
|
+
description: raw_info['bio'],
|
31
|
+
image: raw_info['logo'],
|
32
|
+
urls: { Twitch: "http://www.twitch.tv/#{raw_info['name']}" }
|
33
33
|
}
|
34
34
|
end
|
35
35
|
|
@@ -53,12 +53,16 @@ module OmniAuth
|
|
53
53
|
options.access_token_options.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }
|
54
54
|
end
|
55
55
|
|
56
|
+
def callback_url
|
57
|
+
return options[:redirect_uri] unless options[:redirect_uri].nil?
|
58
|
+
full_host + script_name + callback_path
|
59
|
+
end
|
60
|
+
|
56
61
|
def authorize_params
|
57
62
|
super.tap do |params|
|
58
63
|
options[:authorize_options].each do |k|
|
59
64
|
params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
|
60
65
|
end
|
61
|
-
|
62
66
|
params[:scope] = params[:scope] || DEFAULT_SCOPE
|
63
67
|
end
|
64
68
|
end
|
data/omniauth-twitch.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'omniauth/twitch/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "omniauth-twitch"
|
8
8
|
spec.version = OmniAuth::Twitch::VERSION
|
9
|
-
spec.authors = ["Jonathan Gertig"]
|
10
|
-
spec.email = ["jcgertig@gmail.com"]
|
9
|
+
spec.authors = ["Jonathan Gertig (Webtheory) and William Holt (Webtheory)"]
|
10
|
+
spec.email = ["jcgertig@gmail.com or sithtoast@gmail.com"]
|
11
11
|
spec.summary = 'Twitch OAuth2 Strategy for OmniAuth'
|
12
12
|
spec.homepage = "https://github.com/WebTheoryLLC/omniauth-twitch"
|
13
13
|
spec.license = "MIT"
|
metadata
CHANGED
@@ -1,65 +1,65 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-twitch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Jonathan Gertig
|
7
|
+
- Jonathan Gertig (Webtheory) and William Holt (Webtheory)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.5'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description:
|
56
56
|
email:
|
57
|
-
- jcgertig@gmail.com
|
57
|
+
- jcgertig@gmail.com or sithtoast@gmail.com
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
62
|
+
- ".gitignore"
|
63
63
|
- Gemfile
|
64
64
|
- LICENSE.txt
|
65
65
|
- README.md
|
@@ -79,17 +79,17 @@ require_paths:
|
|
79
79
|
- lib
|
80
80
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.4.5
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: Twitch OAuth2 Strategy for OmniAuth
|