omniauth-facebook 9.0.0 β 11.0.0
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/.github/dependabot.yml +6 -0
- data/.github/workflows/ci.yml +7 -11
- data/.github/workflows/stale.yml +2 -2
- data/CHANGELOG.md +16 -0
- data/README.md +10 -8
- data/lib/omniauth/facebook/signed_request.rb +1 -1
- data/lib/omniauth/facebook/version.rb +1 -1
- data/lib/omniauth/strategies/facebook.rb +9 -11
- data/omniauth-facebook.gemspec +3 -2
- data/test/helper.rb +1 -1
- data/test/signed_request_test.rb +1 -1
- data/test/strategy_test.rb +18 -32
- data/test/support/shared_examples.rb +5 -5
- metadata +26 -13
- data/example/Gemfile +0 -5
- data/example/Gemfile.lock +0 -63
- data/example/app.rb +0 -86
- data/example/config.ru +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84cc0553d04d99409310d315bd015cdb8ccb9d9b44a7e1ba2e4e5dc1bb0e3352
|
|
4
|
+
data.tar.gz: '0810f2c70af2a19545eb8ba78917f50fd484fd49763e7000d184d66f4775a892'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f43b2f8440b47bea9033b951ea6195abd1e2618204790830cefaf5e2b98ccb67d6c4e2678531f654e5e647738008ef8f21d25bd29837b5f4438ad4e84abd0205
|
|
7
|
+
data.tar.gz: d193ba5cb97033c62c4127f32155d5741f324adf6582e9e567c36e75b9e7eef7ec0c67b95decf37e20e97ebbfe025dcb7b5682dad11798adf7b83ec123c1998e
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -4,25 +4,21 @@ on: [push, pull_request]
|
|
|
4
4
|
|
|
5
5
|
jobs:
|
|
6
6
|
test:
|
|
7
|
-
runs-on:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
8
|
strategy:
|
|
9
9
|
fail-fast: false
|
|
10
10
|
matrix:
|
|
11
|
-
os:
|
|
12
|
-
- ubuntu
|
|
13
11
|
ruby:
|
|
14
|
-
- "
|
|
15
|
-
- "
|
|
16
|
-
- "
|
|
17
|
-
-
|
|
12
|
+
- "3.3"
|
|
13
|
+
- "3.4"
|
|
14
|
+
- "4.0"
|
|
15
|
+
- head
|
|
18
16
|
steps:
|
|
19
|
-
- uses: actions/checkout@
|
|
17
|
+
- uses: actions/checkout@v7
|
|
20
18
|
- name: Set up Ruby
|
|
21
19
|
uses: ruby/setup-ruby@v1
|
|
22
20
|
with:
|
|
23
21
|
ruby-version: ${{ matrix.ruby }}
|
|
24
|
-
bundler-cache: true
|
|
25
|
-
- name: Install dependencies
|
|
26
|
-
run: bundle install
|
|
22
|
+
bundler-cache: true # 'bundle install' and cache
|
|
27
23
|
- name: Run tests
|
|
28
24
|
run: bundle exec rake
|
data/.github/workflows/stale.yml
CHANGED
|
@@ -17,7 +17,7 @@ jobs:
|
|
|
17
17
|
stale-pr-message: 'This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
|
|
18
18
|
stale-issue-label: 'no-issue-activity'
|
|
19
19
|
stale-pr-label: 'no-pr-activity'
|
|
20
|
-
days-before-stale:
|
|
21
|
-
days-before-close:
|
|
20
|
+
days-before-stale: 90
|
|
21
|
+
days-before-close: 60
|
|
22
22
|
exempt-pr-label: 'pinned'
|
|
23
23
|
exempt-issue-label: 'pinned'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 11.0.0 (2026-07-18)
|
|
2
|
+
|
|
3
|
+
Changes:
|
|
4
|
+
|
|
5
|
+
- bumped version of FB Graph API to v24.0
|
|
6
|
+
- remove access token from profile picture URL (#388, @Rubyist007)
|
|
7
|
+
|
|
8
|
+
## 10.0.0 (2024-05-23)
|
|
9
|
+
|
|
10
|
+
Changes:
|
|
11
|
+
|
|
12
|
+
- bumped version of FB Graph API to v19.0
|
|
13
|
+
- add `config_id` to per-request options and configuration (#386, @harism2)
|
|
14
|
+
- fix duplicated `script_name` in `callback_url` (#380, @tak1n)
|
|
15
|
+
- add `bigdecimal` dependency for Ruby 3.4 compatibility
|
|
16
|
+
|
|
1
17
|
## 9.0.0 (2021-10-25)
|
|
2
18
|
|
|
3
19
|
Changes:
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# OmniAuth Facebook [](https://github.com/simi/omniauth-facebook/actions/workflows/ci.yml) [](https://rubygems.org/gems/omniauth-facebook)
|
|
2
2
|
|
|
3
3
|
π£ **NOTICE** Weβre looking for maintainers to help keep this project up-to-date. If you are interested in helping please open an Issue expressing your interest. Thanks! π£
|
|
4
4
|
|
|
@@ -39,7 +39,9 @@ You can configure several options, which you pass in to the `provider` method vi
|
|
|
39
39
|
Option name | Default | Explanation
|
|
40
40
|
--- | --- | ---
|
|
41
41
|
`scope` | `email` | A comma-separated list of permissions you want to request from the user. See the Facebook docs for a full list of available permissions: https://developers.facebook.com/docs/reference/login/
|
|
42
|
-
`display` | `page` | The display context to show the authentication page. Options are: `page`, `popup` and
|
|
42
|
+
`display` | `page` | The display context to show the authentication page. Options are: `page`, `popup` and
|
|
43
|
+
`config_id` | | The configuration ID to use for a System User access token with Facebook Login for Business. Read the Facebook docs for more details: https://developers.facebook.com/docs/facebook-login/facebook-login-for-business#invoke-a--login-dialog
|
|
44
|
+
`touch`. Read the Facebook docs for more details: https://developers.facebook.com/docs/reference/dialogs/oauth/
|
|
43
45
|
`image_size` | `square` | Set the size for the returned image url in the auth hash. Valid options include `square` (50x50), `small` (50 pixels wide, variable height), `normal` (100 pixels wide, variable height), or `large` (about 200 pixels wide, variable height). Additionally, you can request a picture of a specific size by setting this option to a hash with `:width` and `:height` as keys. This will return an available profile picture closest to the requested size and requested aspect ratio. If only `:width` or `:height` is specified, we will return a picture whose width or height is closest to the requested size, respectively.
|
|
44
46
|
`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
47
|
`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/.
|
|
@@ -58,21 +60,21 @@ end
|
|
|
58
60
|
|
|
59
61
|
### API Version
|
|
60
62
|
|
|
61
|
-
OmniAuth Facebook uses versioned API endpoints by default (current
|
|
63
|
+
OmniAuth Facebook uses versioned API endpoints by default (current v24.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 v20.0 (assuming that exists):
|
|
62
64
|
|
|
63
65
|
```ruby
|
|
64
66
|
use OmniAuth::Builder do
|
|
65
67
|
provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'],
|
|
66
68
|
client_options: {
|
|
67
|
-
site: 'https://graph.facebook.com/
|
|
68
|
-
authorize_url: "https://www.facebook.com/
|
|
69
|
+
site: 'https://graph.facebook.com/v20.0',
|
|
70
|
+
authorize_url: "https://www.facebook.com/v20.0/dialog/oauth"
|
|
69
71
|
}
|
|
70
72
|
end
|
|
71
73
|
```
|
|
72
74
|
|
|
73
75
|
### Per-Request Options
|
|
74
76
|
|
|
75
|
-
If you want to set the `display` format, `auth_type`, or `
|
|
77
|
+
If you want to set the `display` format, `auth_type`, `scope` or `config_id` on a per-request basis, you can just pass it to the OmniAuth request phase URL, for example: `/auth/facebook?display=popup`, `/auth/facebook?scope=email` or `/auth/facebook?config_id=001`.
|
|
76
78
|
|
|
77
79
|
## Auth Hash
|
|
78
80
|
|
|
@@ -87,7 +89,7 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
|
|
87
89
|
name: 'Joe Bloggs',
|
|
88
90
|
first_name: 'Joe',
|
|
89
91
|
last_name: 'Bloggs',
|
|
90
|
-
image: 'http://graph.facebook.com/1234567/picture?type=square
|
|
92
|
+
image: 'http://graph.facebook.com/1234567/picture?type=square',
|
|
91
93
|
verified: true
|
|
92
94
|
},
|
|
93
95
|
credentials: {
|
|
@@ -152,7 +154,7 @@ If you use the server-side flow, Facebook will give you back a longer lived acce
|
|
|
152
154
|
|
|
153
155
|
## Supported Rubies
|
|
154
156
|
|
|
155
|
-
- Ruby MRI (
|
|
157
|
+
- Ruby MRI (3.0, 3.1, 3.2 and 3.3)
|
|
156
158
|
|
|
157
159
|
## License
|
|
158
160
|
|
|
@@ -28,7 +28,7 @@ module OmniAuth
|
|
|
28
28
|
return if signature.nil?
|
|
29
29
|
|
|
30
30
|
decoded_hex_signature = base64_decode_url(signature)
|
|
31
|
-
decoded_payload =
|
|
31
|
+
decoded_payload = JSON.parse(base64_decode_url(encoded_payload))
|
|
32
32
|
|
|
33
33
|
unless decoded_payload['algorithm'] == SUPPORTED_ALGORITHM
|
|
34
34
|
raise UnknownSignatureAlgorithmError, "unknown algorithm: #{decoded_payload['algorithm']}"
|
|
@@ -10,7 +10,7 @@ module OmniAuth
|
|
|
10
10
|
class NoAuthorizationCodeError < StandardError; end
|
|
11
11
|
|
|
12
12
|
DEFAULT_SCOPE = 'email'
|
|
13
|
-
DEFAULT_FACEBOOK_API_VERSION = '
|
|
13
|
+
DEFAULT_FACEBOOK_API_VERSION = 'v24.0'.freeze
|
|
14
14
|
|
|
15
15
|
option :client_options, {
|
|
16
16
|
site: "https://graph.facebook.com/#{DEFAULT_FACEBOOK_API_VERSION}",
|
|
@@ -25,7 +25,7 @@ module OmniAuth
|
|
|
25
25
|
|
|
26
26
|
option :authorization_code_from_signed_request_in_cookie, nil
|
|
27
27
|
|
|
28
|
-
option :authorize_options, [:scope, :display, :auth_type]
|
|
28
|
+
option :authorize_options, [:scope, :display, :auth_type, :config_id]
|
|
29
29
|
|
|
30
30
|
option :secure_image_url, true
|
|
31
31
|
|
|
@@ -85,7 +85,7 @@ module OmniAuth
|
|
|
85
85
|
''
|
|
86
86
|
else
|
|
87
87
|
# Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7
|
|
88
|
-
options[:callback_url] || (full_host +
|
|
88
|
+
options[:callback_url] || (full_host + callback_path)
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
91
|
|
|
@@ -93,13 +93,13 @@ module OmniAuth
|
|
|
93
93
|
options.access_token_options.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
-
# You can pass +display+, +scope+, or +
|
|
96
|
+
# You can pass +display+, +scope+, +auth_type+ or +config_id+ params to the auth request, if you need to set them dynamically.
|
|
97
97
|
# You can also set these options in the OmniAuth config :authorize_params option.
|
|
98
98
|
#
|
|
99
99
|
# For example: /auth/facebook?display=popup
|
|
100
100
|
def authorize_params
|
|
101
101
|
super.tap do |params|
|
|
102
|
-
%w[display scope auth_type].each do |v|
|
|
102
|
+
%w[display scope auth_type config_id].each do |v|
|
|
103
103
|
if request.params[v]
|
|
104
104
|
params[v.to_sym] = request.params[v]
|
|
105
105
|
end
|
|
@@ -164,15 +164,13 @@ module OmniAuth
|
|
|
164
164
|
uri_class = options[:secure_image_url] ? URI::HTTPS : URI::HTTP
|
|
165
165
|
site_uri = URI.parse(client.site)
|
|
166
166
|
url = uri_class.build({host: site_uri.host, path: "#{site_uri.path}/#{uid}/picture"})
|
|
167
|
-
query = { access_token: access_token.token }
|
|
168
167
|
|
|
169
|
-
if options[:image_size].is_a?(String) || options[:image_size].is_a?(Symbol)
|
|
170
|
-
|
|
168
|
+
query = if options[:image_size].is_a?(String) || options[:image_size].is_a?(Symbol)
|
|
169
|
+
{ type: options[:image_size] }
|
|
171
170
|
elsif options[:image_size].is_a?(Hash)
|
|
172
|
-
|
|
171
|
+
options[:image_size]
|
|
173
172
|
end
|
|
174
|
-
|
|
175
|
-
url.query = Rack::Utils.build_query(query)
|
|
173
|
+
url.query = Rack::Utils.build_query(query) if query
|
|
176
174
|
|
|
177
175
|
url.to_s
|
|
178
176
|
end
|
data/omniauth-facebook.gemspec
CHANGED
|
@@ -11,12 +11,13 @@ Gem::Specification.new do |s|
|
|
|
11
11
|
s.homepage = 'https://github.com/simi/omniauth-facebook'
|
|
12
12
|
s.license = 'MIT'
|
|
13
13
|
|
|
14
|
-
s.files = `git ls-files`.split("\n")
|
|
14
|
+
s.files = `git ls-files`.split("\n").reject { |path| path.start_with? "example/" }
|
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
17
17
|
s.require_paths = ['lib']
|
|
18
18
|
|
|
19
|
-
s.add_runtime_dependency 'omniauth-oauth2', '
|
|
19
|
+
s.add_runtime_dependency 'omniauth-oauth2', '>= 1.2', '< 3'
|
|
20
|
+
s.add_runtime_dependency 'bigdecimal'
|
|
20
21
|
|
|
21
22
|
s.add_development_dependency 'minitest'
|
|
22
23
|
s.add_development_dependency 'mocha'
|
data/test/helper.rb
CHANGED
data/test/signed_request_test.rb
CHANGED
|
@@ -5,7 +5,7 @@ class SignedRequestTest < Minitest::Test
|
|
|
5
5
|
def setup
|
|
6
6
|
@value = fixture('signed_request.txt').strip
|
|
7
7
|
@secret = "897z956a2z7zzzzz5783z458zz3z7556"
|
|
8
|
-
@expected_payload =
|
|
8
|
+
@expected_payload = JSON.parse(fixture('payload.json'))
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def test_signed_request_payload
|
data/test/strategy_test.rb
CHANGED
|
@@ -26,10 +26,11 @@ end
|
|
|
26
26
|
class CallbackUrlTest < StrategyTestCase
|
|
27
27
|
test "returns the default callback url (omitting querystring)" do
|
|
28
28
|
url_base = 'http://auth.request.com'
|
|
29
|
+
script_name = '/script_name'
|
|
29
30
|
@request.stubs(:url).returns("#{url_base}/some/page")
|
|
30
|
-
strategy.stubs(:script_name).returns(
|
|
31
|
+
strategy.stubs(:script_name).returns(script_name) # as not to depend on Rack env
|
|
31
32
|
strategy.stubs(:query_string).returns('?foo=bar')
|
|
32
|
-
assert_equal "#{url_base}/auth/facebook/callback", strategy.callback_url
|
|
33
|
+
assert_equal "#{url_base}#{script_name}/auth/facebook/callback", strategy.callback_url
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
test "returns path from callback_path option (omitting querystring)" do
|
|
@@ -60,6 +61,12 @@ class AuthorizeParamsTest < StrategyTestCase
|
|
|
60
61
|
assert_equal 'touch', strategy.authorize_params[:display]
|
|
61
62
|
end
|
|
62
63
|
|
|
64
|
+
test 'includes config_id parameter from request when present' do
|
|
65
|
+
@request.stubs(:params).returns({ 'config_id' => '000111222' })
|
|
66
|
+
assert strategy.authorize_params.is_a?(Hash)
|
|
67
|
+
assert_equal '000111222', strategy.authorize_params[:config_id]
|
|
68
|
+
end
|
|
69
|
+
|
|
63
70
|
test 'includes auth_type parameter from request when present' do
|
|
64
71
|
@request.stubs(:params).returns({ 'auth_type' => 'reauthenticate' })
|
|
65
72
|
assert strategy.authorize_params.is_a?(Hash)
|
|
@@ -95,67 +102,54 @@ class UidTest < StrategyTestCase
|
|
|
95
102
|
end
|
|
96
103
|
|
|
97
104
|
class InfoTest < StrategyTestCase
|
|
98
|
-
def setup
|
|
99
|
-
super
|
|
100
|
-
@access_token = stub('OAuth2::AccessToken')
|
|
101
|
-
@access_token.stubs(:token).returns('test_access_token')
|
|
102
|
-
end
|
|
103
|
-
|
|
104
105
|
test 'returns the secure facebook avatar url when `secure_image_url` option is set to true' do
|
|
105
106
|
@options = { secure_image_url: true }
|
|
106
107
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
107
108
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
108
|
-
|
|
109
|
-
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
|
109
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture", strategy.info['image']
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
test 'returns the non-ssl facebook avatar url when `secure_image_url` option is set to false' do
|
|
113
113
|
@options = { secure_image_url: false }
|
|
114
114
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
115
115
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
116
|
-
|
|
117
|
-
assert_equal "http://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
|
116
|
+
assert_equal "http://graph.facebook.com/#{@facebook_api_version}/321/picture", strategy.info['image']
|
|
118
117
|
end
|
|
119
118
|
|
|
120
119
|
test 'returns the secure facebook avatar url when `secure_image_url` option is omitted' do
|
|
121
120
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
122
121
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
123
|
-
|
|
124
|
-
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
|
122
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture", strategy.info['image']
|
|
125
123
|
end
|
|
126
124
|
|
|
127
125
|
test 'returns the image_url based of the client site' do
|
|
128
126
|
@options = { secure_image_url: true, client_options: {site: "https://blah.facebook.com/v2.2"}}
|
|
129
127
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
130
128
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
131
|
-
strategy.
|
|
132
|
-
assert_equal "https://blah.facebook.com/v2.2/321/picture?access_token=test_access_token", strategy.info['image']
|
|
129
|
+
assert_equal "https://blah.facebook.com/v2.2/321/picture", strategy.info['image']
|
|
133
130
|
end
|
|
134
131
|
|
|
135
132
|
test 'returns the image with size specified in the `image_size` option' do
|
|
136
133
|
@options = { image_size: 'normal' }
|
|
137
134
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
138
135
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
139
|
-
|
|
140
|
-
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token&type=normal", strategy.info['image']
|
|
136
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?type=normal", strategy.info['image']
|
|
141
137
|
end
|
|
142
138
|
|
|
143
139
|
test 'returns the image with size specified as a symbol in the `image_size` option' do
|
|
144
140
|
@options = { image_size: :normal }
|
|
145
141
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
146
142
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
147
|
-
|
|
148
|
-
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token&type=normal", strategy.info['image']
|
|
143
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?type=normal", strategy.info['image']
|
|
149
144
|
end
|
|
150
145
|
|
|
151
146
|
test 'returns the image with width and height specified in the `image_size` option' do
|
|
152
147
|
@options = { image_size: { width: 123, height: 987 } }
|
|
153
148
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
154
149
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
155
|
-
strategy.stubs(:access_token).returns(@access_token)
|
|
156
150
|
assert_match 'width=123', strategy.info['image']
|
|
157
151
|
assert_match 'height=987', strategy.info['image']
|
|
158
|
-
assert_match "https://graph.facebook.com/#{@facebook_api_version}/321/picture
|
|
152
|
+
assert_match "https://graph.facebook.com/#{@facebook_api_version}/321/picture", strategy.info['image']
|
|
159
153
|
end
|
|
160
154
|
end
|
|
161
155
|
|
|
@@ -164,10 +158,6 @@ class InfoTestOptionalDataPresent < StrategyTestCase
|
|
|
164
158
|
super
|
|
165
159
|
@raw_info ||= { 'name' => 'Fred Smith' }
|
|
166
160
|
strategy.stubs(:raw_info).returns(@raw_info)
|
|
167
|
-
|
|
168
|
-
access_token = stub('OAuth2::AccessToken')
|
|
169
|
-
access_token.stubs(:token).returns('test_access_token')
|
|
170
|
-
strategy.stubs(:access_token).returns(access_token)
|
|
171
161
|
end
|
|
172
162
|
|
|
173
163
|
test 'returns the name' do
|
|
@@ -206,7 +196,7 @@ class InfoTestOptionalDataPresent < StrategyTestCase
|
|
|
206
196
|
|
|
207
197
|
test 'returns the facebook avatar url' do
|
|
208
198
|
@raw_info['id'] = '321'
|
|
209
|
-
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture
|
|
199
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture", strategy.info['image']
|
|
210
200
|
end
|
|
211
201
|
|
|
212
202
|
test 'returns the Facebook link as the Facebook url' do
|
|
@@ -245,10 +235,6 @@ class InfoTestOptionalDataNotPresent < StrategyTestCase
|
|
|
245
235
|
super
|
|
246
236
|
@raw_info ||= { 'name' => 'Fred Smith' }
|
|
247
237
|
strategy.stubs(:raw_info).returns(@raw_info)
|
|
248
|
-
|
|
249
|
-
access_token = stub('OAuth2::AccessToken')
|
|
250
|
-
access_token.stubs(:token).returns('test_access_token')
|
|
251
|
-
strategy.stubs(:access_token).returns(access_token)
|
|
252
238
|
end
|
|
253
239
|
|
|
254
240
|
test 'has no email key' do
|
|
@@ -427,7 +413,7 @@ end
|
|
|
427
413
|
|
|
428
414
|
module SignedRequestHelpers
|
|
429
415
|
def signed_request(payload, secret)
|
|
430
|
-
encoded_payload = base64_encode_url(
|
|
416
|
+
encoded_payload = base64_encode_url(JSON.dump(payload))
|
|
431
417
|
encoded_signature = base64_encode_url(signature(encoded_payload, secret))
|
|
432
418
|
[encoded_signature, encoded_payload].join('.')
|
|
433
419
|
end
|
|
@@ -8,10 +8,10 @@ module OAuth2StrategyTests
|
|
|
8
8
|
include TokenParamsTests
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
module ClientTests
|
|
13
13
|
extend BlockTestHelper
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
test 'should be initialized with symbolized client_options' do
|
|
16
16
|
@options = { client_options: { 'authorize_url' => 'https://example.com' } }
|
|
17
17
|
assert_equal 'https://example.com', strategy.client.options[:authorize_url]
|
|
@@ -20,7 +20,7 @@ module OAuth2StrategyTests
|
|
|
20
20
|
|
|
21
21
|
module AuthorizeParamsTests
|
|
22
22
|
extend BlockTestHelper
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
test 'should include any authorize params passed in the :authorize_params option' do
|
|
25
25
|
@options = { authorize_params: { foo: 'bar', baz: 'zip' } }
|
|
26
26
|
assert_equal 'bar', strategy.authorize_params['foo']
|
|
@@ -32,7 +32,7 @@ module OAuth2StrategyTests
|
|
|
32
32
|
assert_equal 'bar', strategy.authorize_params['scope']
|
|
33
33
|
assert_equal 'baz', strategy.authorize_params['foo']
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
test 'should exclude top-level options that are not passed' do
|
|
37
37
|
@options = { authorize_options: [:bar] }
|
|
38
38
|
refute_has_key :bar, strategy.authorize_params
|
|
@@ -69,7 +69,7 @@ module OAuth2StrategyTests
|
|
|
69
69
|
|
|
70
70
|
module TokenParamsTests
|
|
71
71
|
extend BlockTestHelper
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
test 'should include any authorize params passed in the :token_params option' do
|
|
74
74
|
@options = { token_params: { foo: 'bar', baz: 'zip' } }
|
|
75
75
|
assert_equal 'bar', strategy.token_params['foo']
|
metadata
CHANGED
|
@@ -1,30 +1,49 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniauth-facebook
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 11.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mark Dodwell
|
|
8
8
|
- Josef Ε imΓ‘nek
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: omniauth-oauth2
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
16
|
requirements:
|
|
18
|
-
- - "
|
|
17
|
+
- - ">="
|
|
19
18
|
- !ruby/object:Gem::Version
|
|
20
19
|
version: '1.2'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '3'
|
|
21
23
|
type: :runtime
|
|
22
24
|
prerelease: false
|
|
23
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
26
|
requirements:
|
|
25
|
-
- - "
|
|
27
|
+
- - ">="
|
|
26
28
|
- !ruby/object:Gem::Version
|
|
27
29
|
version: '1.2'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '3'
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: bigdecimal
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
type: :runtime
|
|
41
|
+
prerelease: false
|
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
28
47
|
- !ruby/object:Gem::Dependency
|
|
29
48
|
name: minitest
|
|
30
49
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -67,7 +86,6 @@ dependencies:
|
|
|
67
86
|
- - ">="
|
|
68
87
|
- !ruby/object:Gem::Version
|
|
69
88
|
version: '0'
|
|
70
|
-
description:
|
|
71
89
|
email:
|
|
72
90
|
- mark@madeofcode.com
|
|
73
91
|
- retro@ballgag.cz
|
|
@@ -75,6 +93,7 @@ executables: []
|
|
|
75
93
|
extensions: []
|
|
76
94
|
extra_rdoc_files: []
|
|
77
95
|
files:
|
|
96
|
+
- ".github/dependabot.yml"
|
|
78
97
|
- ".github/workflows/ci.yml"
|
|
79
98
|
- ".github/workflows/stale.yml"
|
|
80
99
|
- ".gitignore"
|
|
@@ -82,10 +101,6 @@ files:
|
|
|
82
101
|
- Gemfile
|
|
83
102
|
- README.md
|
|
84
103
|
- Rakefile
|
|
85
|
-
- example/Gemfile
|
|
86
|
-
- example/Gemfile.lock
|
|
87
|
-
- example/app.rb
|
|
88
|
-
- example/config.ru
|
|
89
104
|
- lib/omniauth-facebook.rb
|
|
90
105
|
- lib/omniauth/facebook.rb
|
|
91
106
|
- lib/omniauth/facebook/signed_request.rb
|
|
@@ -102,7 +117,6 @@ homepage: https://github.com/simi/omniauth-facebook
|
|
|
102
117
|
licenses:
|
|
103
118
|
- MIT
|
|
104
119
|
metadata: {}
|
|
105
|
-
post_install_message:
|
|
106
120
|
rdoc_options: []
|
|
107
121
|
require_paths:
|
|
108
122
|
- lib
|
|
@@ -117,8 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
117
131
|
- !ruby/object:Gem::Version
|
|
118
132
|
version: '0'
|
|
119
133
|
requirements: []
|
|
120
|
-
rubygems_version:
|
|
121
|
-
signing_key:
|
|
134
|
+
rubygems_version: 4.0.10
|
|
122
135
|
specification_version: 4
|
|
123
136
|
summary: Facebook OAuth2 Strategy for OmniAuth
|
|
124
137
|
test_files:
|
data/example/Gemfile
DELETED
data/example/Gemfile.lock
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: ..
|
|
3
|
-
specs:
|
|
4
|
-
omniauth-facebook (8.0.0)
|
|
5
|
-
omniauth-oauth2 (~> 1.2)
|
|
6
|
-
|
|
7
|
-
GEM
|
|
8
|
-
remote: https://rubygems.org/
|
|
9
|
-
specs:
|
|
10
|
-
backports (3.15.0)
|
|
11
|
-
faraday (1.1.0)
|
|
12
|
-
multipart-post (>= 1.2, < 3)
|
|
13
|
-
ruby2_keywords
|
|
14
|
-
hashie (4.1.0)
|
|
15
|
-
jwt (2.2.2)
|
|
16
|
-
multi_json (1.14.1)
|
|
17
|
-
multi_xml (0.6.0)
|
|
18
|
-
multipart-post (2.1.1)
|
|
19
|
-
mustermann (1.1.1)
|
|
20
|
-
ruby2_keywords (~> 0.0.1)
|
|
21
|
-
oauth2 (1.4.4)
|
|
22
|
-
faraday (>= 0.8, < 2.0)
|
|
23
|
-
jwt (>= 1.0, < 3.0)
|
|
24
|
-
multi_json (~> 1.3)
|
|
25
|
-
multi_xml (~> 0.5)
|
|
26
|
-
rack (>= 1.2, < 3)
|
|
27
|
-
omniauth (1.9.1)
|
|
28
|
-
hashie (>= 3.4.6)
|
|
29
|
-
rack (>= 1.6.2, < 3)
|
|
30
|
-
omniauth-oauth2 (1.7.0)
|
|
31
|
-
oauth2 (~> 1.4)
|
|
32
|
-
omniauth (~> 1.9)
|
|
33
|
-
rack (2.2.3)
|
|
34
|
-
rack-protection (2.0.8.1)
|
|
35
|
-
rack
|
|
36
|
-
ruby2_keywords (0.0.2)
|
|
37
|
-
sinatra (2.0.8.1)
|
|
38
|
-
mustermann (~> 1.0)
|
|
39
|
-
rack (~> 2.0)
|
|
40
|
-
rack-protection (= 2.0.8.1)
|
|
41
|
-
tilt (~> 2.0)
|
|
42
|
-
sinatra-contrib (2.0.8.1)
|
|
43
|
-
backports (>= 2.8.2)
|
|
44
|
-
multi_json
|
|
45
|
-
mustermann (~> 1.0)
|
|
46
|
-
rack-protection (= 2.0.8.1)
|
|
47
|
-
sinatra (= 2.0.8.1)
|
|
48
|
-
tilt (~> 2.0)
|
|
49
|
-
sinatra-reloader (1.0)
|
|
50
|
-
sinatra-contrib
|
|
51
|
-
tilt (2.0.10)
|
|
52
|
-
|
|
53
|
-
PLATFORMS
|
|
54
|
-
ruby
|
|
55
|
-
x64-mingw32
|
|
56
|
-
|
|
57
|
-
DEPENDENCIES
|
|
58
|
-
omniauth-facebook!
|
|
59
|
-
sinatra
|
|
60
|
-
sinatra-reloader
|
|
61
|
-
|
|
62
|
-
BUNDLED WITH
|
|
63
|
-
1.17.3
|
data/example/app.rb
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
require 'sinatra'
|
|
2
|
-
require "sinatra/reloader"
|
|
3
|
-
require 'yaml'
|
|
4
|
-
require 'json'
|
|
5
|
-
|
|
6
|
-
# configure sinatra
|
|
7
|
-
set :run, false
|
|
8
|
-
set :raise_errors, true
|
|
9
|
-
|
|
10
|
-
# REQUEST STEP (server-side flow)
|
|
11
|
-
get '/server-side' do
|
|
12
|
-
# NOTE: You would just hit this endpoint directly from the browser in a real app. The redirect is
|
|
13
|
-
# just here to explicit declare this server-side flow.
|
|
14
|
-
redirect '/auth/facebook'
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# REQUEST STEP (client-side flow)
|
|
18
|
-
get '/client-side' do
|
|
19
|
-
content_type 'text/html'
|
|
20
|
-
# NOTE: When you enable cookie below in the FB.init call the GET request in the FB.login callback
|
|
21
|
-
# will send a signed request in a cookie back the OmniAuth callback which will parse out the
|
|
22
|
-
# authorization code and obtain an access_token with it.
|
|
23
|
-
<<-HTML
|
|
24
|
-
<html>
|
|
25
|
-
<head>
|
|
26
|
-
<title>Client-side Flow Example</title>
|
|
27
|
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js" type="text/javascript"></script>
|
|
28
|
-
<script type="text/javascript">
|
|
29
|
-
window.fbAsyncInit = function() {
|
|
30
|
-
FB.init({
|
|
31
|
-
appId: '#{ENV['FACEBOOK_APP_ID']}',
|
|
32
|
-
version: 'v4.0',
|
|
33
|
-
cookie: true // IMPORTANT must enable cookies to allow the server to access the session
|
|
34
|
-
});
|
|
35
|
-
console.log("fb init");
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
(function(d, s, id){
|
|
39
|
-
var js, fjs = d.getElementsByTagName(s)[0];
|
|
40
|
-
if (d.getElementById(id)) {return;}
|
|
41
|
-
js = d.createElement(s); js.id = id;
|
|
42
|
-
js.src = "//connect.facebook.net/en_US/sdk.js";
|
|
43
|
-
fjs.parentNode.insertBefore(js, fjs);
|
|
44
|
-
}(document, 'script', 'facebook-jssdk'));
|
|
45
|
-
</script>
|
|
46
|
-
</head>
|
|
47
|
-
<body>
|
|
48
|
-
<div id="fb-root"></div>
|
|
49
|
-
|
|
50
|
-
<p id="connect">
|
|
51
|
-
<a href="#">Connect to FB!</a>
|
|
52
|
-
</p>
|
|
53
|
-
|
|
54
|
-
<p id="results" />
|
|
55
|
-
|
|
56
|
-
<script type="text/javascript">
|
|
57
|
-
$('a').click(function(e) {
|
|
58
|
-
e.preventDefault();
|
|
59
|
-
|
|
60
|
-
FB.login(function(response) {
|
|
61
|
-
console.log(response);
|
|
62
|
-
if (response.authResponse) {
|
|
63
|
-
$('#connect').html('Connected! Hitting OmniAuth callback (GET /auth/facebook/callback)...');
|
|
64
|
-
|
|
65
|
-
// since we have cookies enabled, this request will allow omniauth to parse
|
|
66
|
-
// out the auth code from the signed request in the fbsr_XXX cookie
|
|
67
|
-
$.getJSON('/auth/facebook/callback', function(json) {
|
|
68
|
-
$('#connect').html('Connected! Callback complete.');
|
|
69
|
-
$('#results').html(JSON.stringify(json));
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}); // if you want custom scopes, pass them as an extra, final argument to FB.login
|
|
73
|
-
});
|
|
74
|
-
</script>
|
|
75
|
-
</body>
|
|
76
|
-
</html>
|
|
77
|
-
HTML
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
# CALLBACK STEP
|
|
81
|
-
# - redirected here for server-side flow
|
|
82
|
-
# - ajax request made here for client-side flow
|
|
83
|
-
get '/auth/:provider/callback' do
|
|
84
|
-
content_type 'application/json'
|
|
85
|
-
JSON.dump(request.env)
|
|
86
|
-
end
|
data/example/config.ru
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
require 'bundler/setup'
|
|
2
|
-
require 'omniauth-facebook'
|
|
3
|
-
require './app.rb'
|
|
4
|
-
|
|
5
|
-
use Rack::Session::Cookie, secret: 'abc123'
|
|
6
|
-
|
|
7
|
-
use OmniAuth::Builder do
|
|
8
|
-
provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET']
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
run Sinatra::Application
|