omniauth-soundcloud2 1.0.0 → 1.0.1
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 +18 -2
- data/lib/omniauth/soundcloud2/version.rb +1 -1
- data/lib/omniauth/strategies/soundcloud.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: 7d138708a43feb70e82f00238fdf9bf3cd05f521abb1c6b0166989743ccda5eb
|
|
4
|
+
data.tar.gz: 05f3a049f2f354b0371ea587071cddcd84c0c5b79a8a1aa329d015eb23de2403
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b48a57ad3766aa5b72a437721235d1b4711f0da7a9a740e12303de441804a19734299d0b4461756fcf5ca8967d593c6d004cfb62cad29605580f61be3ad86e6b
|
|
7
|
+
data.tar.gz: b5e815b0599cc0b7957fe0b146e46bf51885873df09131b0271f36e8062efe117bd5b456ab566176b41b902e38ffdda60efe9318cdb1a7e9d19d98c86138e7b3
|
data/README.md
CHANGED
|
@@ -31,7 +31,16 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
|
31
31
|
end
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
## Provider App Setup
|
|
35
|
+
|
|
36
|
+
- SoundCloud apps: <https://soundcloud.com/you/apps>
|
|
37
|
+
- OAuth guide: <https://developers.soundcloud.com/docs/api/guide#authentication>
|
|
38
|
+
- Register callback URL (example): `https://your-app.example.com/auth/soundcloud/callback`
|
|
39
|
+
|
|
40
|
+
## Options
|
|
41
|
+
|
|
42
|
+
- `scope` (default: `non-expiring`)
|
|
43
|
+
- `display`
|
|
35
44
|
|
|
36
45
|
## Auth Hash
|
|
37
46
|
|
|
@@ -52,7 +61,8 @@ Example payload from `request.env['omniauth.auth']` (realistic shape, anonymized
|
|
|
52
61
|
"token": "eyJ...redacted...xYxvrQ",
|
|
53
62
|
"refresh_token": "A1B2C3D4E5F6",
|
|
54
63
|
"expires_at": 1772691847,
|
|
55
|
-
"expires": true
|
|
64
|
+
"expires": true,
|
|
65
|
+
"scope": "non-expiring"
|
|
56
66
|
},
|
|
57
67
|
"extra": {
|
|
58
68
|
"raw_info": {
|
|
@@ -121,6 +131,12 @@ RAILS_VERSION='~> 8.1.0' bundle install
|
|
|
121
131
|
RAILS_VERSION='~> 8.1.0' bundle exec rake test_rails_integration
|
|
122
132
|
```
|
|
123
133
|
|
|
134
|
+
## Test Structure
|
|
135
|
+
|
|
136
|
+
- `test/omniauth_soundcloud_test.rb`: strategy/unit behavior
|
|
137
|
+
- `test/rails_integration_test.rb`: full Rack/Rails request+callback flow
|
|
138
|
+
- `test/test_helper.rb`: shared test bootstrap
|
|
139
|
+
|
|
124
140
|
## Compatibility
|
|
125
141
|
|
|
126
142
|
- Ruby: `>= 3.2` (tested on `3.2`, `3.3`, `3.4`, `4.0`)
|
|
@@ -39,6 +39,16 @@ module OmniAuth
|
|
|
39
39
|
}.compact
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
credentials do
|
|
43
|
+
{
|
|
44
|
+
'token' => access_token.token,
|
|
45
|
+
'refresh_token' => access_token.refresh_token,
|
|
46
|
+
'expires_at' => access_token.expires_at,
|
|
47
|
+
'expires' => access_token.expires?,
|
|
48
|
+
'scope' => token_scope
|
|
49
|
+
}.compact
|
|
50
|
+
end
|
|
51
|
+
|
|
42
52
|
extra do
|
|
43
53
|
{
|
|
44
54
|
'raw_info' => raw_info
|
|
@@ -63,6 +73,11 @@ module OmniAuth
|
|
|
63
73
|
|
|
64
74
|
private
|
|
65
75
|
|
|
76
|
+
def token_scope
|
|
77
|
+
token_params = access_token.respond_to?(:params) ? access_token.params : {}
|
|
78
|
+
token_params['scope'] || (access_token['scope'] if access_token.respond_to?(:[]))
|
|
79
|
+
end
|
|
80
|
+
|
|
66
81
|
def urls
|
|
67
82
|
data = {
|
|
68
83
|
SoundCloud: raw_info['permalink_url'],
|