omniauth-facebook 8.0.0 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +28 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -5
- data/README.md +4 -4
- data/example/Gemfile.lock +12 -11
- data/lib/omniauth/facebook/version.rb +1 -1
- data/lib/omniauth/strategies/facebook.rb +5 -2
- data/test/helper.rb +2 -0
- data/test/strategy_test.rb +27 -12
- metadata +8 -8
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b51f78b3013a92af5b911a3eb98f86685a0cc16c8d2922ef0fb273aa8dae6cea
|
4
|
+
data.tar.gz: f7ff402165f1f8e0d1e1ef88e212f8bd7e30e0a3a291de125b4f8f1907e0554a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d5d625cc5b137e56479f15be3dbb3cf7bc0bf201c27e31c79807d443a09ae6c158b158ef193645e297058ae3064e64cbee6202ba13ee4abef462fb9357f17f1
|
7
|
+
data.tar.gz: d13123c4ca19743aa01821339e1ab44b083c5611b5a3a3b876a07e97cecf7dfa9aeba4e80aa030d399ec8430455aba2ca33857458c85a37f64bbe14d64743a54
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
runs-on: ${{ matrix.os }}-latest
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
os:
|
12
|
+
- ubuntu
|
13
|
+
ruby:
|
14
|
+
- "2.5"
|
15
|
+
- "2.6"
|
16
|
+
- "2.7"
|
17
|
+
- "3.0"
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- name: Set up Ruby
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
bundler-cache: true
|
25
|
+
- name: Install dependencies
|
26
|
+
run: bundle install
|
27
|
+
- name: Run tests
|
28
|
+
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -44,7 +44,7 @@ Option name | Default | Explanation
|
|
44
44
|
`info_fields` | `name,email` | Specify exactly which fields should be returned when getting the user's info. Value should be a comma-separated string as per https://developers.facebook.com/docs/graph-api/reference/user/ (only `/me` endpoint).
|
45
45
|
`locale` | | Specify locale which should be used when getting the user's info. Value should be locale string as per https://developers.facebook.com/docs/reference/api/locale/.
|
46
46
|
`auth_type` | | Optionally specifies the requested authentication features as a comma-separated list, as per https://developers.facebook.com/docs/facebook-login/reauthentication/. Valid values are `https` (checks for the presence of the secure cookie and asks for re-authentication if it is not present), and `reauthenticate` (asks the user to re-authenticate unconditionally). Use 'rerequest' when you want to request premissions. Default is `nil`.
|
47
|
-
`secure_image_url` | `
|
47
|
+
`secure_image_url` | `true` | Set to `true` to use https for the avatar image url returned in the auth hash. SSL is mandatory as per https://developers.facebook.com/docs/facebook-login/security#surfacearea.
|
48
48
|
`callback_url` / `callback_path` | | Specify a custom callback URL used during the server-side flow. Note this must be allowed by your app configuration on Facebook (see 'Valid OAuth redirect URIs' under the 'Advanced' settings section in the configuration for your Facebook app for more details).
|
49
49
|
|
50
50
|
For example, to request `email`, `user_birthday` and `read_stream` permissions and display the authentication page in a popup window:
|
@@ -58,7 +58,7 @@ end
|
|
58
58
|
|
59
59
|
### API Version
|
60
60
|
|
61
|
-
OmniAuth Facebook uses versioned API endpoints by default (current
|
61
|
+
OmniAuth Facebook uses versioned API endpoints by default (current v5.0). You can configure a different version via `client_options` hash passed to `provider`, specifically you should change the version in the `site` and `authorize_url` parameters. For example, to change to v7.0 (assuming that exists):
|
62
62
|
|
63
63
|
```ruby
|
64
64
|
use OmniAuth::Builder do
|
@@ -87,7 +87,7 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
|
87
87
|
name: 'Joe Bloggs',
|
88
88
|
first_name: 'Joe',
|
89
89
|
last_name: 'Bloggs',
|
90
|
-
image: 'http://graph.facebook.com/1234567/picture?type=square',
|
90
|
+
image: 'http://graph.facebook.com/1234567/picture?type=square&access_token=...',
|
91
91
|
verified: true
|
92
92
|
},
|
93
93
|
credentials: {
|
@@ -152,7 +152,7 @@ If you use the server-side flow, Facebook will give you back a longer lived acce
|
|
152
152
|
|
153
153
|
## Supported Rubies
|
154
154
|
|
155
|
-
- Ruby MRI (2.
|
155
|
+
- Ruby MRI (2.5, 2.6, 2.7, 3.0)
|
156
156
|
|
157
157
|
## License
|
158
158
|
|
data/example/Gemfile.lock
CHANGED
@@ -1,35 +1,36 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
omniauth-facebook (
|
4
|
+
omniauth-facebook (8.0.0)
|
5
5
|
omniauth-oauth2 (~> 1.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
backports (3.15.0)
|
11
|
-
faraday (1.
|
11
|
+
faraday (1.1.0)
|
12
12
|
multipart-post (>= 1.2, < 3)
|
13
|
-
|
14
|
-
|
13
|
+
ruby2_keywords
|
14
|
+
hashie (4.1.0)
|
15
|
+
jwt (2.2.2)
|
15
16
|
multi_json (1.14.1)
|
16
17
|
multi_xml (0.6.0)
|
17
18
|
multipart-post (2.1.1)
|
18
19
|
mustermann (1.1.1)
|
19
20
|
ruby2_keywords (~> 0.0.1)
|
20
|
-
oauth2 (1.4.
|
21
|
+
oauth2 (1.4.4)
|
21
22
|
faraday (>= 0.8, < 2.0)
|
22
23
|
jwt (>= 1.0, < 3.0)
|
23
24
|
multi_json (~> 1.3)
|
24
25
|
multi_xml (~> 0.5)
|
25
26
|
rack (>= 1.2, < 3)
|
26
|
-
omniauth (1.9.
|
27
|
-
hashie (>= 3.4.6
|
27
|
+
omniauth (1.9.1)
|
28
|
+
hashie (>= 3.4.6)
|
28
29
|
rack (>= 1.6.2, < 3)
|
29
|
-
omniauth-oauth2 (1.
|
30
|
-
oauth2 (~> 1.
|
30
|
+
omniauth-oauth2 (1.7.0)
|
31
|
+
oauth2 (~> 1.4)
|
31
32
|
omniauth (~> 1.9)
|
32
|
-
rack (2.
|
33
|
+
rack (2.2.3)
|
33
34
|
rack-protection (2.0.8.1)
|
34
35
|
rack
|
35
36
|
ruby2_keywords (0.0.2)
|
@@ -59,4 +60,4 @@ DEPENDENCIES
|
|
59
60
|
sinatra-reloader
|
60
61
|
|
61
62
|
BUNDLED WITH
|
62
|
-
1.17.
|
63
|
+
1.17.3
|
@@ -10,10 +10,11 @@ module OmniAuth
|
|
10
10
|
class NoAuthorizationCodeError < StandardError; end
|
11
11
|
|
12
12
|
DEFAULT_SCOPE = 'email'
|
13
|
+
DEFAULT_FACEBOOK_API_VERSION = 'v5.0'.freeze
|
13
14
|
|
14
15
|
option :client_options, {
|
15
|
-
site:
|
16
|
-
authorize_url: "https://www.facebook.com/
|
16
|
+
site: "https://graph.facebook.com/#{DEFAULT_FACEBOOK_API_VERSION}",
|
17
|
+
authorize_url: "https://www.facebook.com/#{DEFAULT_FACEBOOK_API_VERSION}/dialog/oauth",
|
17
18
|
token_url: 'oauth/access_token'
|
18
19
|
}
|
19
20
|
|
@@ -26,6 +27,8 @@ module OmniAuth
|
|
26
27
|
|
27
28
|
option :authorize_options, [:scope, :display, :auth_type]
|
28
29
|
|
30
|
+
option :secure_image_url, true
|
31
|
+
|
29
32
|
uid { raw_info['id'] }
|
30
33
|
|
31
34
|
info do
|
data/test/helper.rb
CHANGED
data/test/strategy_test.rb
CHANGED
@@ -9,11 +9,11 @@ end
|
|
9
9
|
|
10
10
|
class ClientTest < StrategyTestCase
|
11
11
|
test 'has correct Facebook site' do
|
12
|
-
assert_equal
|
12
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}", strategy.client.site
|
13
13
|
end
|
14
14
|
|
15
15
|
test 'has correct authorize url' do
|
16
|
-
assert_equal
|
16
|
+
assert_equal "https://www.facebook.com/#{@facebook_api_version}/dialog/oauth", strategy.client.options[:authorize_url]
|
17
17
|
end
|
18
18
|
|
19
19
|
test 'has correct token url with versioning' do
|
@@ -101,12 +101,27 @@ class InfoTest < StrategyTestCase
|
|
101
101
|
@access_token.stubs(:token).returns('test_access_token')
|
102
102
|
end
|
103
103
|
|
104
|
-
test 'returns the secure facebook avatar url when `secure_image_url` option is
|
104
|
+
test 'returns the secure facebook avatar url when `secure_image_url` option is set to true' do
|
105
105
|
@options = { secure_image_url: true }
|
106
106
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
107
107
|
strategy.stubs(:raw_info).returns(raw_info)
|
108
108
|
strategy.stubs(:access_token).returns(@access_token)
|
109
|
-
assert_equal
|
109
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
110
|
+
end
|
111
|
+
|
112
|
+
test 'returns the non-ssl facebook avatar url when `secure_image_url` option is set to false' do
|
113
|
+
@options = { secure_image_url: false }
|
114
|
+
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
115
|
+
strategy.stubs(:raw_info).returns(raw_info)
|
116
|
+
strategy.stubs(:access_token).returns(@access_token)
|
117
|
+
assert_equal "http://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
118
|
+
end
|
119
|
+
|
120
|
+
test 'returns the secure facebook avatar url when `secure_image_url` option is omitted' do
|
121
|
+
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
122
|
+
strategy.stubs(:raw_info).returns(raw_info)
|
123
|
+
strategy.stubs(:access_token).returns(@access_token)
|
124
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
110
125
|
end
|
111
126
|
|
112
127
|
test 'returns the image_url based of the client site' do
|
@@ -122,7 +137,7 @@ class InfoTest < StrategyTestCase
|
|
122
137
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
123
138
|
strategy.stubs(:raw_info).returns(raw_info)
|
124
139
|
strategy.stubs(:access_token).returns(@access_token)
|
125
|
-
assert_equal
|
140
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token&type=normal", strategy.info['image']
|
126
141
|
end
|
127
142
|
|
128
143
|
test 'returns the image with size specified as a symbol in the `image_size` option' do
|
@@ -130,7 +145,7 @@ class InfoTest < StrategyTestCase
|
|
130
145
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
131
146
|
strategy.stubs(:raw_info).returns(raw_info)
|
132
147
|
strategy.stubs(:access_token).returns(@access_token)
|
133
|
-
assert_equal
|
148
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token&type=normal", strategy.info['image']
|
134
149
|
end
|
135
150
|
|
136
151
|
test 'returns the image with width and height specified in the `image_size` option' do
|
@@ -140,7 +155,7 @@ class InfoTest < StrategyTestCase
|
|
140
155
|
strategy.stubs(:access_token).returns(@access_token)
|
141
156
|
assert_match 'width=123', strategy.info['image']
|
142
157
|
assert_match 'height=987', strategy.info['image']
|
143
|
-
assert_match
|
158
|
+
assert_match "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
144
159
|
end
|
145
160
|
end
|
146
161
|
|
@@ -191,7 +206,7 @@ class InfoTestOptionalDataPresent < StrategyTestCase
|
|
191
206
|
|
192
207
|
test 'returns the facebook avatar url' do
|
193
208
|
@raw_info['id'] = '321'
|
194
|
-
assert_equal
|
209
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
195
210
|
end
|
196
211
|
|
197
212
|
test 'returns the Facebook link as the Facebook url' do
|
@@ -277,7 +292,7 @@ class RawInfoTest < StrategyTestCase
|
|
277
292
|
@options = {appsecret_proof: @appsecret_proof, fields: 'name,email'}
|
278
293
|
end
|
279
294
|
|
280
|
-
test
|
295
|
+
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me" do
|
281
296
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
282
297
|
strategy.stubs(:access_token).returns(@access_token)
|
283
298
|
params = {params: @options}
|
@@ -285,7 +300,7 @@ class RawInfoTest < StrategyTestCase
|
|
285
300
|
strategy.raw_info
|
286
301
|
end
|
287
302
|
|
288
|
-
test
|
303
|
+
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me with locale" do
|
289
304
|
@options.merge!({ locale: 'cs_CZ' })
|
290
305
|
strategy.stubs(:access_token).returns(@access_token)
|
291
306
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
@@ -294,7 +309,7 @@ class RawInfoTest < StrategyTestCase
|
|
294
309
|
strategy.raw_info
|
295
310
|
end
|
296
311
|
|
297
|
-
test
|
312
|
+
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me with info_fields" do
|
298
313
|
@options.merge!({info_fields: 'about'})
|
299
314
|
strategy.stubs(:access_token).returns(@access_token)
|
300
315
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
@@ -303,7 +318,7 @@ class RawInfoTest < StrategyTestCase
|
|
303
318
|
strategy.raw_info
|
304
319
|
end
|
305
320
|
|
306
|
-
test
|
321
|
+
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me with default info_fields" do
|
307
322
|
strategy.stubs(:access_token).returns(@access_token)
|
308
323
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
309
324
|
params = {params: {appsecret_proof: @appsecret_proof, fields: 'name,email'}}
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-facebook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Dodwell
|
8
8
|
- Josef Šimánek
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-oauth2
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
-
description:
|
70
|
+
description:
|
71
71
|
email:
|
72
72
|
- mark@madeofcode.com
|
73
73
|
- retro@ballgag.cz
|
@@ -75,9 +75,9 @@ executables: []
|
|
75
75
|
extensions: []
|
76
76
|
extra_rdoc_files: []
|
77
77
|
files:
|
78
|
+
- ".github/workflows/ci.yml"
|
78
79
|
- ".github/workflows/stale.yml"
|
79
80
|
- ".gitignore"
|
80
|
-
- ".travis.yml"
|
81
81
|
- CHANGELOG.md
|
82
82
|
- Gemfile
|
83
83
|
- README.md
|
@@ -102,7 +102,7 @@ homepage: https://github.com/simi/omniauth-facebook
|
|
102
102
|
licenses:
|
103
103
|
- MIT
|
104
104
|
metadata: {}
|
105
|
-
post_install_message:
|
105
|
+
post_install_message:
|
106
106
|
rdoc_options: []
|
107
107
|
require_paths:
|
108
108
|
- lib
|
@@ -117,8 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
|
-
rubygems_version: 3.2.
|
121
|
-
signing_key:
|
120
|
+
rubygems_version: 3.2.22
|
121
|
+
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Facebook OAuth2 Strategy for OmniAuth
|
124
124
|
test_files:
|