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 +4 -4
- data/README.md +19 -1
- data/lib/omniauth/spotify/version.rb +1 -1
- data/lib/omniauth/strategies/spotify.rb +15 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc8741608bbfa92369035a3998b72a27b73a17a67b603688d5cc55d9fdb47728
|
|
4
|
+
data.tar.gz: fdc122f1bb1adc612c2bb2de212c69da8a16ec4323a4b79ba178fccef1f4532f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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`)
|
|
@@ -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) ||
|