omniauth-twitchtv2 1.0.2 → 1.0.4
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/README.md +3 -3
- data/lib/omniauth/strategies/twitchtv.rb +32 -32
- data/lib/omniauth/twitchtv2/version.rb +1 -1
- data/lib/omniauth/twitchtv2.rb +2 -2
- data/lib/omniauth-twitchtv/version.rb +1 -1
- data/lib/omniauth-twitchtv.rb +1 -1
- data/lib/omniauth-twitchtv2/version.rb +1 -1
- data/lib/omniauth-twitchtv2.rb +1 -1
- data/omniauth-twitchtv2.gemspec +21 -21
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 376b53f87af9c76da1099d614bba912b3f7d3642dc40e8837789977adaa15734
|
|
4
|
+
data.tar.gz: fd652cd3f043a6474c9c84ba957a06110ed0fb78b9b94573436d903b6f14f82d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dfae4ba08f4cc920fc5559bce0934f1ea7b521f71c8a1251aeb8d61b31a0f17b88f71c051caaa70747107e22e64562042dfd2764bef8dcaa23ecf84afb609589
|
|
7
|
+
data.tar.gz: 326c77e3df3c166d13526fb194a776c4f778ce39bda5b54423a62a61893013cb8a2f02f32a0797a1af543aaa277be1e0687634ff7850e536fbbba0b16b7838b7
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# OmniAuth
|
|
1
|
+
# OmniAuth Twitch Strategy
|
|
2
2
|
|
|
3
3
|
[](https://github.com/icoretech/omniauth-twitchtv2/actions/workflows/test.yml?query=branch%3Amain)
|
|
4
|
-
[](https://badge.fury.io/rb/omniauth-twitchtv2)
|
|
5
5
|
|
|
6
6
|
`omniauth-twitchtv2` provides a Twitch OAuth2 strategy for OmniAuth.
|
|
7
7
|
|
|
@@ -110,7 +110,7 @@ RAILS_VERSION='~> 8.1.0' bundle exec rake test_rails_integration
|
|
|
110
110
|
## Compatibility
|
|
111
111
|
|
|
112
112
|
- Ruby: `>= 3.2` (tested on `3.2`, `3.3`, `3.4`, `4.0`)
|
|
113
|
-
- `omniauth-oauth2`: `>= 1.8`, `<
|
|
113
|
+
- `omniauth-oauth2`: `>= 1.8`, `< 2.0`
|
|
114
114
|
- Rails integration lanes: `~> 7.1.0`, `~> 7.2.0`, `~> 8.0.0`, `~> 8.1.0`
|
|
115
115
|
|
|
116
116
|
## Release
|
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
3
|
+
require "omniauth-oauth2"
|
|
4
4
|
|
|
5
5
|
module OmniAuth
|
|
6
6
|
module Strategies
|
|
7
7
|
# OmniAuth strategy for Twitch OAuth2.
|
|
8
8
|
class Twitchtv < OmniAuth::Strategies::OAuth2
|
|
9
|
-
option :name,
|
|
9
|
+
option :name, "twitchtv"
|
|
10
10
|
|
|
11
11
|
option :client_options,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
site: "https://api.twitch.tv",
|
|
13
|
+
authorize_url: "https://id.twitch.tv/oauth2/authorize",
|
|
14
|
+
token_url: "https://id.twitch.tv/oauth2/token",
|
|
15
|
+
auth_scheme: :request_body,
|
|
16
|
+
connection_opts: {
|
|
17
|
+
headers: {
|
|
18
|
+
user_agent: "icoretech-omniauth-twitchtv2 gem",
|
|
19
|
+
accept: "application/json",
|
|
20
|
+
content_type: "application/json"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
23
|
|
|
24
24
|
option :authorize_options, %i[scope force_verify]
|
|
25
25
|
|
|
26
|
-
uid { raw_info[
|
|
26
|
+
uid { raw_info["id"].to_s }
|
|
27
27
|
|
|
28
28
|
info do
|
|
29
29
|
{
|
|
30
|
-
name: raw_info[
|
|
31
|
-
nickname: raw_info[
|
|
32
|
-
email: raw_info[
|
|
33
|
-
image: raw_info[
|
|
34
|
-
description: blank_to_nil(raw_info[
|
|
35
|
-
urls: profile_url ? {
|
|
30
|
+
name: raw_info["display_name"] || raw_info["login"],
|
|
31
|
+
nickname: raw_info["login"],
|
|
32
|
+
email: raw_info["email"],
|
|
33
|
+
image: raw_info["profile_image_url"],
|
|
34
|
+
description: blank_to_nil(raw_info["description"]),
|
|
35
|
+
urls: profile_url ? {twitchtv: profile_url} : nil
|
|
36
36
|
}.compact
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
credentials do
|
|
40
40
|
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
"token" => access_token.token,
|
|
42
|
+
"refresh_token" => access_token.refresh_token,
|
|
43
|
+
"expires_at" => access_token.expires_at,
|
|
44
|
+
"expires" => access_token.expires?,
|
|
45
|
+
"scope" => token_scope
|
|
46
46
|
}.compact
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
extra do
|
|
50
50
|
{
|
|
51
|
-
|
|
51
|
+
"raw_info" => raw_info
|
|
52
52
|
}
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def raw_info
|
|
56
56
|
@raw_info ||= begin
|
|
57
|
-
response = access_token.get(
|
|
58
|
-
users = response.parsed.fetch(
|
|
57
|
+
response = access_token.get("helix/users", headers: {"Client-Id" => options.client_id})
|
|
58
|
+
users = response.parsed.fetch("data", [])
|
|
59
59
|
users.first || {}
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def profile_url
|
|
64
|
-
login = raw_info[
|
|
64
|
+
login = raw_info["login"]
|
|
65
65
|
return nil if login.to_s.empty?
|
|
66
66
|
|
|
67
67
|
"https://www.twitch.tv/#{login}"
|
|
@@ -74,7 +74,7 @@ module OmniAuth
|
|
|
74
74
|
|
|
75
75
|
# Prevent authorization response params from being appended to redirect_uri.
|
|
76
76
|
def query_string
|
|
77
|
-
return
|
|
77
|
+
return "" if request.params["code"]
|
|
78
78
|
|
|
79
79
|
super
|
|
80
80
|
end
|
|
@@ -83,7 +83,7 @@ module OmniAuth
|
|
|
83
83
|
|
|
84
84
|
def token_scope
|
|
85
85
|
token_params = access_token.respond_to?(:params) ? access_token.params : {}
|
|
86
|
-
token_params[
|
|
86
|
+
token_params["scope"] || (access_token["scope"] if access_token.respond_to?(:[]))
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
def blank_to_nil(value)
|
|
@@ -97,4 +97,4 @@ module OmniAuth
|
|
|
97
97
|
end
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
-
OmniAuth.config.add_camelization
|
|
100
|
+
OmniAuth.config.add_camelization "twitchtv", "Twitchtv"
|
data/lib/omniauth/twitchtv2.rb
CHANGED
data/lib/omniauth-twitchtv.rb
CHANGED
data/lib/omniauth-twitchtv2.rb
CHANGED
data/omniauth-twitchtv2.gemspec
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
lib = File.expand_path(
|
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
-
require
|
|
5
|
+
require "omniauth/twitchtv2/version"
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
|
-
spec.name =
|
|
8
|
+
spec.name = "omniauth-twitchtv2"
|
|
9
9
|
spec.version = OmniAuth::Twitchtv2::VERSION
|
|
10
|
-
spec.authors = [
|
|
11
|
-
spec.email = [
|
|
10
|
+
spec.authors = ["Claudio Poli"]
|
|
11
|
+
spec.email = ["masterkain@gmail.com"]
|
|
12
12
|
|
|
13
|
-
spec.summary =
|
|
14
|
-
spec.description =
|
|
15
|
-
spec.homepage =
|
|
16
|
-
spec.license =
|
|
17
|
-
spec.required_ruby_version =
|
|
13
|
+
spec.summary = "OmniAuth strategy for Twitch OAuth2 authentication."
|
|
14
|
+
spec.description = "OAuth2 strategy for OmniAuth that authenticates users with Twitch and exposes account metadata."
|
|
15
|
+
spec.homepage = "https://github.com/icoretech/omniauth-twitchtv2"
|
|
16
|
+
spec.license = "MIT"
|
|
17
|
+
spec.required_ruby_version = ">= 3.2"
|
|
18
18
|
|
|
19
|
-
spec.metadata[
|
|
20
|
-
spec.metadata[
|
|
21
|
-
spec.metadata[
|
|
22
|
-
spec.metadata[
|
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/icoretech/omniauth-twitchtv2"
|
|
20
|
+
spec.metadata["bug_tracker_uri"] = "https://github.com/icoretech/omniauth-twitchtv2/issues"
|
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/icoretech/omniauth-twitchtv2/releases"
|
|
22
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
23
23
|
|
|
24
24
|
spec.files = Dir[
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
"lib/**/*.rb",
|
|
26
|
+
"README*",
|
|
27
|
+
"LICENSE*",
|
|
28
|
+
"*.gemspec"
|
|
29
29
|
]
|
|
30
|
-
spec.require_paths = [
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
31
31
|
|
|
32
|
-
spec.add_dependency
|
|
33
|
-
spec.add_dependency
|
|
32
|
+
spec.add_dependency "cgi", ">= 0.3.6"
|
|
33
|
+
spec.add_dependency "omniauth-oauth2", ">= 1.8", "< 2.0"
|
|
34
34
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniauth-twitchtv2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Claudio Poli
|
|
@@ -32,7 +32,7 @@ dependencies:
|
|
|
32
32
|
version: '1.8'
|
|
33
33
|
- - "<"
|
|
34
34
|
- !ruby/object:Gem::Version
|
|
35
|
-
version: '
|
|
35
|
+
version: '2.0'
|
|
36
36
|
type: :runtime
|
|
37
37
|
prerelease: false
|
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -42,7 +42,7 @@ dependencies:
|
|
|
42
42
|
version: '1.8'
|
|
43
43
|
- - "<"
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: '
|
|
45
|
+
version: '2.0'
|
|
46
46
|
description: OAuth2 strategy for OmniAuth that authenticates users with Twitch and
|
|
47
47
|
exposes account metadata.
|
|
48
48
|
email:
|