omniauth-twitchtv2 1.0.1 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edb0c195f852ffc1186501076e8565298175e186b2ef74f4626517096d17d9ab
4
- data.tar.gz: 57fa18c318d73e4a7f6880712a087a0814f039f88795f63897eac2c113b7c5bf
3
+ metadata.gz: 567329f384848763a47bcd4c71509434544212a294656eb520fff9574178dd0c
4
+ data.tar.gz: 3aee9529f2cffc81c67d1bc743993f7ed4485c32dbb903aeafbc71a9e6046d38
5
5
  SHA512:
6
- metadata.gz: 32045c9a362321cb4930da29cd5af652a097650fc6850962145702dbdd619982bf75311f5bbc0ae264b2a37048d4cf1669cfd0bfcec9c11b0d8383b6551aab9d
7
- data.tar.gz: 8d7adc1af4b7ca7033da65fa04bbd0fef8b5c97dcf824ee12b83661337305c63b2ce8df5d8c5bf96aa389a6636f464c86ab88989eb5aad399c9dfd0e4477facf
6
+ metadata.gz: e4387d4e0bcd27638feee22e53403d48b3fc285a8f053971f8a16e354f777bc82c96e4dec968b89d27ef96d61a20ee9948417b0e17d3a2e8ee9d4f6cfcaeb0f5
7
+ data.tar.gz: 3ea15c29e420eabe8bb1a51cbe13f88418784f313f55ce9a2819331d337d293d54dba72c5cd771faf6f1279364f9443509ad044d6d54969d7196959caacb8502
data/README.md CHANGED
@@ -32,6 +32,17 @@ Rails.application.config.middleware.use OmniAuth::Builder do
32
32
  end
33
33
  ```
34
34
 
35
+ ## Provider App Setup
36
+
37
+ - Twitch developer console: <https://dev.twitch.tv/console/apps>
38
+ - OAuth docs: <https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/>
39
+ - Register callback URL (example): `https://your-app.example.com/auth/twitchtv/callback`
40
+
41
+ ## Options
42
+
43
+ - `scope` (for example `user:read:email`)
44
+ - `force_verify`
45
+
35
46
  ## Auth Hash
36
47
 
37
48
  Example payload from `request.env['omniauth.auth']` (realistic shape, anonymized):
@@ -53,7 +64,8 @@ Example payload from `request.env['omniauth.auth']` (realistic shape, anonymized
53
64
  "token": "sample-access-token",
54
65
  "refresh_token": "sample-refresh-token",
55
66
  "expires_at": 1710000000,
56
- "expires": true
67
+ "expires": true,
68
+ "scope": "user:read:email"
57
69
  },
58
70
  "extra": {
59
71
  "raw_info": {
@@ -89,6 +101,12 @@ RAILS_VERSION='~> 8.1.0' bundle install
89
101
  RAILS_VERSION='~> 8.1.0' bundle exec rake test_rails_integration
90
102
  ```
91
103
 
104
+ ## Test Structure
105
+
106
+ - `test/omniauth_twitchtv_test.rb`: strategy/unit behavior
107
+ - `test/rails_integration_test.rb`: full Rack/Rails request+callback flow
108
+ - `test/test_helper.rb`: shared test bootstrap
109
+
92
110
  ## Compatibility
93
111
 
94
112
  - Ruby: `>= 3.2` (tested on `3.2`, `3.3`, `3.4`, `4.0`)
@@ -36,6 +36,16 @@ module OmniAuth
36
36
  }.compact
37
37
  end
38
38
 
39
+ credentials do
40
+ {
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
+ }.compact
47
+ end
48
+
39
49
  extra do
40
50
  {
41
51
  'raw_info' => raw_info
@@ -71,6 +81,11 @@ module OmniAuth
71
81
 
72
82
  private
73
83
 
84
+ def token_scope
85
+ token_params = access_token.respond_to?(:params) ? access_token.params : {}
86
+ token_params['scope'] || (access_token['scope'] if access_token.respond_to?(:[]))
87
+ end
88
+
74
89
  def blank_to_nil(value)
75
90
  return nil if value.respond_to?(:empty?) && value.empty?
76
91
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Twitchtv2
5
- VERSION = '1.0.1'
5
+ VERSION = '1.0.2'
6
6
  end
7
7
  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.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Poli