omniauth-spotify 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: a1468293039a29cd8d1f4757139d5fece6bae3ac3c73f1f4275ae4553d0405c3
4
- data.tar.gz: d7275eb0deb58c3b24310b50aef1216fc4970ac6cb4dab4e6efa798dfdc17efe
3
+ metadata.gz: cc8741608bbfa92369035a3998b72a27b73a17a67b603688d5cc55d9fdb47728
4
+ data.tar.gz: fdc122f1bb1adc612c2bb2de212c69da8a16ec4323a4b79ba178fccef1f4532f
5
5
  SHA512:
6
- metadata.gz: '091df662a286585d04d94895780f1e7bf7603fe23959ff0e12f9d86306577c7f88a6ed3cba009dfed146c50adc35a8cffcbee17c3716bd62f4e8294fd779e943'
7
- data.tar.gz: 8c4d1d9d2b6d23c623159128ce271ec3bbb1880cfb400d13cc616ca2ec72d5b0d931caee92e16e36b689b8be34ffafabefc78689f9a76eb6cfb77016c7497dd9
6
+ metadata.gz: ded11472a459b53ffcb5250e0f581a311b516cc1c2985d52ffdec91c3b0f1bb0596c64aa3210ca2d465ca426c50e1b1d10cdf1cb01a3340c9b2e6912a98536f6
7
+ data.tar.gz: ea62dfdad9b92d5813a3fffe1752e31d74d15f7e92a013d854a56b50dcf4454e17e072dd38c70f9f94225c475ee3aae70e0c7c93924f39d4de3b965ece499a7b
data/README.md CHANGED
@@ -30,6 +30,17 @@ Rails.application.config.middleware.use OmniAuth::Builder do
30
30
  end
31
31
  ```
32
32
 
33
+ ## Provider App Setup
34
+
35
+ - Spotify developer dashboard: <https://developer.spotify.com/dashboard>
36
+ - OAuth scopes reference: <https://developer.spotify.com/documentation/web-api/concepts/scopes>
37
+ - Register callback URL (example): `https://your-app.example.com/auth/spotify/callback`
38
+
39
+ ## Options
40
+
41
+ - `scope`
42
+ - `show_dialog`
43
+
33
44
  ## Forcing a Permission Dialog
34
45
 
35
46
  Spotify may skip the permission dialog when the user already granted access. To force it:
@@ -62,7 +73,8 @@ Example payload from `request.env['omniauth.auth']` (real shape, anonymized):
62
73
  "token": "sample-access-token",
63
74
  "refresh_token": "sample-refresh-token",
64
75
  "expires_at": 1710000000,
65
- "expires": true
76
+ "expires": true,
77
+ "scope": "user-read-email user-read-private"
66
78
  },
67
79
  "extra": {
68
80
  "raw_info": {
@@ -107,6 +119,12 @@ RAILS_VERSION='~> 8.1.0' bundle install
107
119
  RAILS_VERSION='~> 8.1.0' bundle exec rake test_rails_integration
108
120
  ```
109
121
 
122
+ ## Test Structure
123
+
124
+ - `test/omniauth_spotify_test.rb`: strategy/unit behavior
125
+ - `test/rails_integration_test.rb`: full Rack/Rails request+callback flow
126
+ - `test/test_helper.rb`: shared test bootstrap
127
+
110
128
  ## Compatibility
111
129
 
112
130
  - Ruby: `>= 3.2` (tested on `3.2`, `3.3`, `3.4`, `4.0`)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Spotify
5
- VERSION = '1.0.1'
5
+ VERSION = '1.0.2'
6
6
  end
7
7
  end
@@ -40,6 +40,16 @@ module OmniAuth
40
40
  }.compact
41
41
  end
42
42
 
43
+ credentials do
44
+ {
45
+ 'token' => access_token.token,
46
+ 'refresh_token' => access_token.refresh_token,
47
+ 'expires_at' => access_token.expires_at,
48
+ 'expires' => access_token.expires?,
49
+ 'scope' => token_scope
50
+ }.compact
51
+ end
52
+
43
53
  extra do
44
54
  {
45
55
  'raw_info' => raw_info
@@ -79,6 +89,11 @@ module OmniAuth
79
89
 
80
90
  private
81
91
 
92
+ def token_scope
93
+ token_params = access_token.respond_to?(:params) ? access_token.params : {}
94
+ token_params['scope'] || (access_token['scope'] if access_token.respond_to?(:[]))
95
+ end
96
+
82
97
  def force_approval_requested?
83
98
  session.delete(FORCE_APPROVAL_KEY) ||
84
99
  session.delete(LEGACY_FORCE_APPROVAL_KEY) ||
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-spotify
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