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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de07dc27eb8810abd1b2a688449e1ad0360f063a5c233c0c36f1902a721be927
4
- data.tar.gz: f938ca12195ac5e3581e39802d5f54e82bae3fc22e71db51d1ce4a62b25750cd
3
+ metadata.gz: b51f78b3013a92af5b911a3eb98f86685a0cc16c8d2922ef0fb273aa8dae6cea
4
+ data.tar.gz: f7ff402165f1f8e0d1e1ef88e212f8bd7e30e0a3a291de125b4f8f1907e0554a
5
5
  SHA512:
6
- metadata.gz: 90f607d371c1e1b73cfb854d9fb1e0f7abb5e65d8e08d2043de57f20079ac4bcff5461f3bd3c536c47506ec174029a49cb500d536485649e4ac044cf5009ae8a
7
- data.tar.gz: c30e200b472c2ddfbf9566ff14c2ca34e408a0380d41ed8328a2580fa21a3349f214767211d7574a744e9a8d35f61e44423a643a6a42419fa2f96d6f73ba38fd
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
@@ -1,3 +1,9 @@
1
+ ## 9.0.0 (2021-10-25)
2
+
3
+ Changes:
4
+
5
+ - bumped version of FB Graph API to v5.0
6
+
1
7
  ## 8.0.0 (2020-10-20)
2
8
 
3
9
  Changes:
data/Gemfile CHANGED
@@ -2,8 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'rack', RUBY_VERSION < '2.2.2' ? '~> 1.6' : '>= 2.0'
6
-
7
- platforms :rbx do
8
- gem 'rubysl', '~> 2.0'
9
- end
5
+ gem 'rack', '>= 2.0'
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` | `false` | Set to `true` to use https for the avatar image url returned in the auth hash.
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 v4.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):
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.3, 2.4, 2.5, 2.6)
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 (6.0.0)
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.0.0)
11
+ faraday (1.1.0)
12
12
  multipart-post (>= 1.2, < 3)
13
- hashie (3.6.0)
14
- jwt (2.2.1)
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.2)
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.0)
27
- hashie (>= 3.4.6, < 3.7.0)
27
+ omniauth (1.9.1)
28
+ hashie (>= 3.4.6)
28
29
  rack (>= 1.6.2, < 3)
29
- omniauth-oauth2 (1.6.0)
30
- oauth2 (~> 1.1)
30
+ omniauth-oauth2 (1.7.0)
31
+ oauth2 (~> 1.4)
31
32
  omniauth (~> 1.9)
32
- rack (2.1.1)
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.2
63
+ 1.17.3
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Facebook
3
- VERSION = '8.0.0'
3
+ VERSION = '9.0.0'
4
4
  end
5
5
  end
@@ -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: 'https://graph.facebook.com/v4.0',
16
- authorize_url: "https://www.facebook.com/v4.0/dialog/oauth",
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
@@ -42,6 +42,8 @@ class StrategyTestCase < TestCase
42
42
  @client_id = '123'
43
43
  @client_secret = '53cr3tz'
44
44
  @options = {}
45
+
46
+ @facebook_api_version = OmniAuth::Strategies::Facebook::DEFAULT_FACEBOOK_API_VERSION
45
47
  end
46
48
 
47
49
  def strategy
@@ -9,11 +9,11 @@ end
9
9
 
10
10
  class ClientTest < StrategyTestCase
11
11
  test 'has correct Facebook site' do
12
- assert_equal 'https://graph.facebook.com/v4.0', strategy.client.site
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 'https://www.facebook.com/v4.0/dialog/oauth', strategy.client.options[:authorize_url]
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 specified' do
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 'https://graph.facebook.com/v4.0/321/picture?access_token=test_access_token', strategy.info['image']
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 'http://graph.facebook.com/v4.0/321/picture?access_token=test_access_token&type=normal', strategy.info['image']
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 'http://graph.facebook.com/v4.0/321/picture?access_token=test_access_token&type=normal', strategy.info['image']
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 'http://graph.facebook.com/v4.0/321/picture?access_token=test_access_token', strategy.info['image']
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 'http://graph.facebook.com/v4.0/321/picture?access_token=test_access_token', strategy.info['image']
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 'performs a GET to https://graph.facebook.com/v4.0/me' do
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 'performs a GET to https://graph.facebook.com/v4.0/me with locale' do
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 'performs a GET to https://graph.facebook.com/v4.0/me with info_fields' do
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 'performs a GET to https://graph.facebook.com/v4.0/me with default info_fields' do
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: 8.0.0
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: 2020-10-19 00:00:00.000000000 Z
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.0.pre1
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:
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.7
5
- - 2.6
6
- - 2.5