omniauth-dropbox2 2.0.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a6349d9df69cc57527820672cc6e6ba312dceaa4d73a7cc55dbfd56c864c7ae
4
- data.tar.gz: 7433fb5e3023623ab7320ce6cafbfa78bd4a2670203f86bcfb7d13b85545e26b
3
+ metadata.gz: 3c9b7e808498b8a2c402dfc33e7e3b6bed9c75de13480df640b144ff2c53a7d0
4
+ data.tar.gz: 7d7121180df1b2ef59abb5f77eb996ee3dec923b8e4ea414a0275a03335f89a6
5
5
  SHA512:
6
- metadata.gz: fc4b2958475984fdb4555d55b1f8d62eda6d76b47fdfa0d5ddd350786524752af1a52c4aa2d3a21deeaba48bd067b87eed96d287aa73a879b35fce4983183fd5
7
- data.tar.gz: 49f4cfed9ed5a94361f5553a63f4cb1ae97e3198cc55e481fe084fe10ffffe07cb05d0206c992957616a4f10e016d4728149493ccaeaf0a91468717bffe9321c
6
+ metadata.gz: 8f634d46da852ab09a786a7fe9432b7e245b6ed9e91841550848728f0e3b90dd0bb8313e0315ca5dc18d74b22fd9dd49bce0dfbeaad6a7514ec5da93d347cdbd
7
+ data.tar.gz: 52ba48fac291da44ed3ce4e948368bcb296e7c03f517dddf72f134218489430fc5d25bd16ffeed4d7a967c509f9b20a30ad2ab1f610a699b0a0ccc8c1da83411
data/README.md CHANGED
@@ -29,11 +29,66 @@ use OmniAuth::Builder do
29
29
  end
30
30
  ```
31
31
 
32
- Auth hash includes:
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
+
41
+ ## Auth Hash
42
+
43
+ Example payload from `request.env['omniauth.auth']` (real flow shape, anonymized):
44
+
45
+ ```json
46
+ {
47
+ "uid": "dbid:sample-account-id",
48
+ "info": {
49
+ "name": "Sample User"
50
+ },
51
+ "credentials": {
52
+ "token": "sample-access-token",
53
+ "refresh_token": "sample-refresh-token",
54
+ "expires": false,
55
+ "scope": "files.metadata.read"
56
+ },
57
+ "extra": {
58
+ "raw_info": {
59
+ "account_id": "dbid:sample-account-id",
60
+ "name": {
61
+ "given_name": "Sample",
62
+ "surname": "User",
63
+ "familiar_name": "Sample",
64
+ "display_name": "Sample User",
65
+ "abbreviated_name": "SU"
66
+ },
67
+ "email": "sample@example.test",
68
+ "email_verified": true,
69
+ "disabled": false,
70
+ "country": "IT",
71
+ "locale": "en",
72
+ "referral_link": "https://www.dropbox.com/referrals/AABsample",
73
+ "is_paired": false,
74
+ "account_type": {
75
+ ".tag": "basic"
76
+ },
77
+ "root_info": {
78
+ ".tag": "user",
79
+ "root_namespace_id": "123456",
80
+ "home_namespace_id": "123456"
81
+ }
82
+ }
83
+ }
84
+ }
85
+ ```
33
86
 
34
- - `uid`: Dropbox `account_id`
35
- - `info[:name]`: Dropbox display name
36
- - `extra['raw_info']`: full response from `users/get_current_account`
87
+ Notes:
88
+ - `uid` is mapped from `raw_info.account_id`
89
+ - `info.name` is mapped from `raw_info.name.display_name`
90
+ - `credentials` includes `token`, plus `refresh_token` when provided by Dropbox
91
+ - `extra.raw_info` is the full `users/get_current_account` response
37
92
 
38
93
  ## Development
39
94
 
@@ -54,6 +109,12 @@ RAILS_VERSION='~> 8.1.0' bundle install
54
109
  RAILS_VERSION='~> 8.1.0' bundle exec rake test_rails_integration
55
110
  ```
56
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
+
57
118
  ## Compatibility
58
119
 
59
120
  - 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 Dropbox2
5
- VERSION = '2.0.2'
5
+ VERSION = '2.0.4'
6
6
  end
7
7
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-dropbox2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Poli