omniauth-dropbox2 2.0.3 → 2.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 +22 -0
- data/lib/omniauth/dropbox2/version.rb +1 -1
- data/lib/omniauth/strategies/dropbox.rb +17 -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: 3c9b7e808498b8a2c402dfc33e7e3b6bed9c75de13480df640b144ff2c53a7d0
|
|
4
|
+
data.tar.gz: 7d7121180df1b2ef59abb5f77eb996ee3dec923b8e4ea414a0275a03335f89a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8f634d46da852ab09a786a7fe9432b7e245b6ed9e91841550848728f0e3b90dd0bb8313e0315ca5dc18d74b22fd9dd49bce0dfbeaad6a7514ec5da93d347cdbd
|
|
7
|
+
data.tar.gz: 52ba48fac291da44ed3ce4e948368bcb296e7c03f517dddf72f134218489430fc5d25bd16ffeed4d7a967c509f9b20a30ad2ab1f610a699b0a0ccc8c1da83411
|
data/README.md
CHANGED
|
@@ -29,6 +29,15 @@ use OmniAuth::Builder do
|
|
|
29
29
|
end
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
## Provider App Setup
|
|
33
|
+
|
|
34
|
+
- Dropbox app console: <https://www.dropbox.com/developers/apps>
|
|
35
|
+
- Register callback URL (example): `https://your-app.example.com/auth/dropbox/callback`
|
|
36
|
+
|
|
37
|
+
## Options
|
|
38
|
+
|
|
39
|
+
- Request-phase query options can be passed directly to `/auth/dropbox` when supported by Dropbox OAuth endpoints.
|
|
40
|
+
|
|
32
41
|
## Auth Hash
|
|
33
42
|
|
|
34
43
|
Example payload from `request.env['omniauth.auth']` (real flow shape, anonymized):
|
|
@@ -39,6 +48,12 @@ Example payload from `request.env['omniauth.auth']` (real flow shape, anonymized
|
|
|
39
48
|
"info": {
|
|
40
49
|
"name": "Sample User"
|
|
41
50
|
},
|
|
51
|
+
"credentials": {
|
|
52
|
+
"token": "sample-access-token",
|
|
53
|
+
"refresh_token": "sample-refresh-token",
|
|
54
|
+
"expires": false,
|
|
55
|
+
"scope": "files.metadata.read"
|
|
56
|
+
},
|
|
42
57
|
"extra": {
|
|
43
58
|
"raw_info": {
|
|
44
59
|
"account_id": "dbid:sample-account-id",
|
|
@@ -72,6 +87,7 @@ Example payload from `request.env['omniauth.auth']` (real flow shape, anonymized
|
|
|
72
87
|
Notes:
|
|
73
88
|
- `uid` is mapped from `raw_info.account_id`
|
|
74
89
|
- `info.name` is mapped from `raw_info.name.display_name`
|
|
90
|
+
- `credentials` includes `token`, plus `refresh_token` when provided by Dropbox
|
|
75
91
|
- `extra.raw_info` is the full `users/get_current_account` response
|
|
76
92
|
|
|
77
93
|
## Development
|
|
@@ -93,6 +109,12 @@ RAILS_VERSION='~> 8.1.0' bundle install
|
|
|
93
109
|
RAILS_VERSION='~> 8.1.0' bundle exec rake test_rails_integration
|
|
94
110
|
```
|
|
95
111
|
|
|
112
|
+
## Test Structure
|
|
113
|
+
|
|
114
|
+
- `test/omniauth_dropbox2_test.rb`: strategy/unit behavior
|
|
115
|
+
- `test/rails_integration_test.rb`: full Rack/Rails request+callback flow
|
|
116
|
+
- `test/test_helper.rb`: shared test bootstrap
|
|
117
|
+
|
|
96
118
|
## Compatibility
|
|
97
119
|
|
|
98
120
|
- Ruby: `>= 3.2` (tested on `3.2`, `3.3`, `3.4`, `4.0`)
|
|
@@ -28,6 +28,16 @@ module OmniAuth
|
|
|
28
28
|
}.compact
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
credentials do
|
|
32
|
+
{
|
|
33
|
+
'token' => access_token.token,
|
|
34
|
+
'refresh_token' => access_token.refresh_token,
|
|
35
|
+
'expires_at' => access_token.expires_at,
|
|
36
|
+
'expires' => access_token.expires?,
|
|
37
|
+
'scope' => token_scope
|
|
38
|
+
}.compact
|
|
39
|
+
end
|
|
40
|
+
|
|
31
41
|
extra do
|
|
32
42
|
{
|
|
33
43
|
'raw_info' => raw_info
|
|
@@ -49,6 +59,13 @@ module OmniAuth
|
|
|
49
59
|
|
|
50
60
|
super
|
|
51
61
|
end
|
|
62
|
+
|
|
63
|
+
private
|
|
64
|
+
|
|
65
|
+
def token_scope
|
|
66
|
+
token_params = access_token.respond_to?(:params) ? access_token.params : {}
|
|
67
|
+
token_params['scope'] || (access_token['scope'] if access_token.respond_to?(:[]))
|
|
68
|
+
end
|
|
52
69
|
end
|
|
53
70
|
|
|
54
71
|
Dropbox2 = Dropbox
|