omniauth-twitch 0.2.0 → 0.3.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/.gitignore +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +1 -1
- data/Rakefile +0 -0
- data/lib/omniauth-twitch.rb +0 -0
- data/lib/omniauth/strategies/twitch.rb +26 -14
- data/lib/omniauth/twitch.rb +0 -0
- data/lib/omniauth/twitch/version.rb +1 -1
- data/omniauth-twitch.gemspec +0 -0
- 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: ac4cf3351e0ff9c0c19ae13e5e3410c7206a7fd7
|
|
4
|
+
data.tar.gz: 5db50c2fa3186624c73c054af88331ce8073d0d5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f08515384b3aa3a12e446cde57f894735e10b6c4c8800f0749619842d42b5139452c7225d95ab3465aafc2be71f8e37af1aa96420b266add7bbce1c3f1f5eeda
|
|
7
|
+
data.tar.gz: bed50fd5e039e1cbfde7dbaa43b7dc392b5d63ba5337975fb183d0d324bb7726047f617447126e76b8049e3c32bfd0b1466d989716ac9e249c64cdf95fe758c7
|
data/.gitignore
CHANGED
|
File without changes
|
data/Gemfile
CHANGED
|
File without changes
|
data/LICENSE.txt
CHANGED
|
File without changes
|
data/README.md
CHANGED
data/Rakefile
CHANGED
|
File without changes
|
data/lib/omniauth-twitch.rb
CHANGED
|
File without changes
|
|
@@ -3,33 +3,43 @@ require 'omniauth-oauth2'
|
|
|
3
3
|
module OmniAuth
|
|
4
4
|
module Strategies
|
|
5
5
|
class Twitch < OmniAuth::Strategies::OAuth2
|
|
6
|
-
DEFAULT_SCOPE =
|
|
6
|
+
DEFAULT_SCOPE = "user:read:email".freeze
|
|
7
7
|
|
|
8
8
|
option :name, "twitch"
|
|
9
9
|
|
|
10
10
|
option :client_options, {
|
|
11
|
-
site:
|
|
12
|
-
authorize_url: "/
|
|
13
|
-
token_url:
|
|
11
|
+
site: "https://id.twitch.tv",
|
|
12
|
+
authorize_url: "/oauth2/authorize",
|
|
13
|
+
token_url: "/oauth2/token"
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
option :access_token_options, {
|
|
17
|
-
header_format:
|
|
18
|
-
param_name:
|
|
17
|
+
header_format: "Bearer %s",
|
|
18
|
+
param_name: "access_token"
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
option :authorize_options, [:scope]
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
credentials do
|
|
24
|
+
hash = { "token" => access_token.token }
|
|
25
|
+
if access_token.refresh_token
|
|
26
|
+
hash["refresh_token"] = access_token.refresh_token
|
|
27
|
+
end
|
|
28
|
+
hash["expires_at"] = access_token.expires_at if access_token.expires?
|
|
29
|
+
hash["expires"] = access_token.expires?
|
|
30
|
+
hash
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
uid { raw_info["id"] }
|
|
24
34
|
|
|
25
35
|
info do
|
|
26
36
|
{
|
|
27
|
-
name: raw_info[
|
|
28
|
-
email: raw_info[
|
|
29
|
-
nickname: raw_info[
|
|
30
|
-
description: raw_info[
|
|
31
|
-
image: raw_info[
|
|
32
|
-
urls: { Twitch: "http://www.twitch.tv/#{raw_info['
|
|
37
|
+
name: raw_info["display_name"],
|
|
38
|
+
email: raw_info["email"],
|
|
39
|
+
nickname: raw_info["login"],
|
|
40
|
+
description: raw_info["description"],
|
|
41
|
+
image: raw_info["profile_image_url"],
|
|
42
|
+
urls: { Twitch: "http://www.twitch.tv/#{raw_info['login']}" }
|
|
33
43
|
}
|
|
34
44
|
end
|
|
35
45
|
|
|
@@ -40,7 +50,9 @@ module OmniAuth
|
|
|
40
50
|
end
|
|
41
51
|
|
|
42
52
|
def raw_info
|
|
43
|
-
@raw_info ||=
|
|
53
|
+
@raw_info ||=
|
|
54
|
+
access_token.get("https://api.twitch.tv/helix/users").parsed.
|
|
55
|
+
fetch("data").fetch(0)
|
|
44
56
|
end
|
|
45
57
|
|
|
46
58
|
def build_access_token
|
data/lib/omniauth/twitch.rb
CHANGED
|
File without changes
|
data/omniauth-twitch.gemspec
CHANGED
|
File without changes
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniauth-twitch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonathan Gertig (Webtheory) and William Holt (Webtheory)
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2018-09-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: omniauth-oauth2
|
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
89
89
|
version: '0'
|
|
90
90
|
requirements: []
|
|
91
91
|
rubyforge_project:
|
|
92
|
-
rubygems_version: 2.
|
|
92
|
+
rubygems_version: 2.6.14
|
|
93
93
|
signing_key:
|
|
94
94
|
specification_version: 4
|
|
95
95
|
summary: Twitch OAuth2 Strategy for OmniAuth
|