omniauth-box2 2.0.1 → 2.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 +33 -0
- data/lib/omniauth/box2/version.rb +1 -1
- data/lib/omniauth/strategies/box.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: 13b53739996442e474da313ee85714c9d0f651056172ac03cf02dd1e7066c3ef
|
|
4
|
+
data.tar.gz: 3918f1934f2aadcdedc351a7134b1945ae92af801a0fbc93856b648c267bbffd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3cdc133bdcdf37edf5d8dfe1d55026ff42cd2972355f7b44e132b30c3ff9e4c5495e10c723e9c4236b97ac44dba1cb23a22dac447c61797393a1509adcb47c7
|
|
7
|
+
data.tar.gz: 1c52a1ef2117776d5b031647bae8271b367a950597d26aa142e046ad22aee5b9bff805b20ecc7354585035d08bdfa2f6156b305961bbcde376623ce3b8dbeaf6
|
data/README.md
CHANGED
|
@@ -27,6 +27,16 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
|
27
27
|
end
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
## Provider App Setup
|
|
31
|
+
|
|
32
|
+
- Box developer console: <https://developer.box.com/>
|
|
33
|
+
- Register callback URL (example): `https://your-app.example.com/auth/box/callback`
|
|
34
|
+
|
|
35
|
+
## Options
|
|
36
|
+
|
|
37
|
+
- `callback_url`
|
|
38
|
+
- Request-phase query options can be passed directly to `/auth/box` when supported by Box OAuth endpoints.
|
|
39
|
+
|
|
30
40
|
## Auth Hash
|
|
31
41
|
|
|
32
42
|
Example payload from `request.env['omniauth.auth']` (real flow shape, anonymized):
|
|
@@ -38,6 +48,12 @@ Example payload from `request.env['omniauth.auth']` (real flow shape, anonymized
|
|
|
38
48
|
"name": "Sample User",
|
|
39
49
|
"email": "sample@example.test"
|
|
40
50
|
},
|
|
51
|
+
"credentials": {
|
|
52
|
+
"token": "sample-access-token",
|
|
53
|
+
"refresh_token": "sample-refresh-token",
|
|
54
|
+
"expires": false,
|
|
55
|
+
"scope": "root_readonly"
|
|
56
|
+
},
|
|
41
57
|
"extra": {
|
|
42
58
|
"raw_info": {
|
|
43
59
|
"type": "user",
|
|
@@ -66,6 +82,7 @@ Notes:
|
|
|
66
82
|
- `uid` is mapped from `raw_info.id` (as string)
|
|
67
83
|
- `info.name` is mapped from `raw_info.name`
|
|
68
84
|
- `info.email` is mapped from `raw_info.login`
|
|
85
|
+
- `credentials` includes `token`, plus `refresh_token` when provided by Box
|
|
69
86
|
- `extra.raw_info` is the full `users/me` response
|
|
70
87
|
|
|
71
88
|
## Provider Endpoints
|
|
@@ -84,6 +101,22 @@ bundle exec rake test_unit
|
|
|
84
101
|
bundle exec rake test_rails_integration
|
|
85
102
|
```
|
|
86
103
|
|
|
104
|
+
## Test Structure
|
|
105
|
+
|
|
106
|
+
- `test/omniauth_box2_test.rb`: strategy/unit behavior
|
|
107
|
+
- `test/rails_integration_test.rb`: full Rack/Rails request+callback flow
|
|
108
|
+
- `test/test_helper.rb`: shared test bootstrap
|
|
109
|
+
|
|
110
|
+
## Compatibility
|
|
111
|
+
|
|
112
|
+
- Ruby: `>= 3.2` (tested on `3.2`, `3.3`, `3.4`, `4.0`)
|
|
113
|
+
- `omniauth-oauth2`: `>= 1.8`, `< 1.9`
|
|
114
|
+
- Rails integration lanes: `~> 7.1.0`, `~> 7.2.0`, `~> 8.0.0`, `~> 8.1.0`
|
|
115
|
+
|
|
116
|
+
## Release
|
|
117
|
+
|
|
118
|
+
Tag releases as `vX.Y.Z`; GitHub Actions publishes the gem to RubyGems.
|
|
119
|
+
|
|
87
120
|
## License
|
|
88
121
|
|
|
89
122
|
MIT License. See `LICENSE.txt`.
|
|
@@ -29,6 +29,16 @@ module OmniAuth
|
|
|
29
29
|
}.compact
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
credentials do
|
|
33
|
+
{
|
|
34
|
+
'token' => access_token.token,
|
|
35
|
+
'refresh_token' => access_token.refresh_token,
|
|
36
|
+
'expires_at' => access_token.expires_at,
|
|
37
|
+
'expires' => access_token.expires?,
|
|
38
|
+
'scope' => token_scope
|
|
39
|
+
}.compact
|
|
40
|
+
end
|
|
41
|
+
|
|
32
42
|
extra do
|
|
33
43
|
{
|
|
34
44
|
'raw_info' => raw_info
|
|
@@ -50,6 +60,13 @@ module OmniAuth
|
|
|
50
60
|
|
|
51
61
|
super
|
|
52
62
|
end
|
|
63
|
+
|
|
64
|
+
private
|
|
65
|
+
|
|
66
|
+
def token_scope
|
|
67
|
+
token_params = access_token.respond_to?(:params) ? access_token.params : {}
|
|
68
|
+
token_params['scope'] || (access_token['scope'] if access_token.respond_to?(:[]))
|
|
69
|
+
end
|
|
53
70
|
end
|
|
54
71
|
|
|
55
72
|
Box2 = Box
|