omniauth-facebook 4.0.0.rc1 → 8.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 +5 -5
- data/.github/workflows/stale.yml +23 -0
- data/.travis.yml +5 -11
- data/CHANGELOG.md +28 -3
- data/Gemfile +2 -0
- data/README.md +16 -17
- data/example/Gemfile.lock +37 -34
- data/example/app.rb +4 -3
- data/example/config.ru +1 -1
- data/lib/omniauth/facebook/version.rb +1 -1
- data/lib/omniauth/strategies/facebook.rb +13 -9
- data/omniauth-facebook.gemspec +1 -1
- data/test/helper.rb +2 -1
- data/test/strategy_test.rb +32 -13
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: de07dc27eb8810abd1b2a688449e1ad0360f063a5c233c0c36f1902a721be927
|
4
|
+
data.tar.gz: f938ca12195ac5e3581e39802d5f54e82bae3fc22e71db51d1ce4a62b25750cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90f607d371c1e1b73cfb854d9fb1e0f7abb5e65d8e08d2043de57f20079ac4bcff5461f3bd3c536c47506ec174029a49cb500d536485649e4ac044cf5009ae8a
|
7
|
+
data.tar.gz: c30e200b472c2ddfbf9566ff14c2ca34e408a0380d41ed8328a2580fa21a3349f214767211d7574a744e9a8d35f61e44423a643a6a42419fa2f96d6f73ba38fd
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: Mark stale issues and pull requests
|
2
|
+
|
3
|
+
on:
|
4
|
+
schedule:
|
5
|
+
- cron: "0 0 * * *"
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
stale:
|
9
|
+
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- uses: actions/stale@v1
|
14
|
+
with:
|
15
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
16
|
+
stale-issue-message: 'This issue 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.'
|
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
|
+
stale-issue-label: 'no-issue-activity'
|
19
|
+
stale-pr-label: 'no-pr-activity'
|
20
|
+
days-before-stale: 30
|
21
|
+
days-before-close: 5
|
22
|
+
exempt-pr-label: 'pinned'
|
23
|
+
exempt-issue-label: 'pinned'
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,37 @@
|
|
1
|
-
##
|
1
|
+
## 8.0.0 (2020-10-20)
|
2
|
+
|
3
|
+
Changes:
|
4
|
+
|
5
|
+
- user profile picture link includes access token (#344, @anklos)
|
6
|
+
|
7
|
+
## 7.0.0 (2020-08-03)
|
8
|
+
|
9
|
+
Changes:
|
10
|
+
|
11
|
+
- bumped version of FB Graph API to v4.0
|
12
|
+
|
13
|
+
## 6.0.0 (2020-01-27)
|
14
|
+
|
15
|
+
Changes:
|
16
|
+
|
17
|
+
- bumped version of FB Graph API to v3.0
|
18
|
+
|
19
|
+
## 5.0.0 (2018-03-29)
|
20
|
+
|
21
|
+
Changes:
|
22
|
+
|
23
|
+
- bumped version of FB Graph API to v2.10 (#297, @piotrjaworski)
|
24
|
+
- use only CRuby 2.0+ on CI (#298, @simi)
|
25
|
+
|
26
|
+
## 4.0.0 (2016-07-26)
|
2
27
|
|
3
28
|
Changes:
|
4
29
|
|
5
30
|
- drop support for Ruby < 1.9.3 (@mkdynamic)
|
6
31
|
- switch to versioned FB APIs, currently using v2.6 (#245, @printercu, @mkdynamic)
|
7
32
|
- remove deprecated :nickname field from README example (#223, @abelorian)
|
8
|
-
- add Ruby 2.2 to CI (#225, @tricknotes, @mkdynamic)
|
9
|
-
- update example app (@
|
33
|
+
- add Ruby 2.2 + 2.3.0 to CI (#225, @tricknotes, @mkdynamic, @anoraak)
|
34
|
+
- update example app (@mkdynamic)
|
10
35
|
|
11
36
|
## 3.0.0 (2015-10-26)
|
12
37
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
# OmniAuth Facebook [](https://travis-ci.org/simi/omniauth-facebook) [](https://rubygems.org/gems/omniauth-facebook)
|
2
|
+
|
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! 📣
|
2
4
|
|
3
5
|
**These notes are based on master, please see tags for README pertaining to specific releases.**
|
4
6
|
|
5
7
|
Facebook OAuth2 Strategy for OmniAuth.
|
6
8
|
|
7
|
-
Supports
|
9
|
+
Supports OAuth 2.0 server-side and client-side flows. Read the Facebook docs for more details: http://developers.facebook.com/docs/authentication
|
8
10
|
|
9
11
|
## Installing
|
10
12
|
|
@@ -24,11 +26,11 @@ Here's a quick example, adding the middleware to a Rails app in `config/initiali
|
|
24
26
|
|
25
27
|
```ruby
|
26
28
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
27
|
-
provider :facebook, ENV['
|
29
|
+
provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET']
|
28
30
|
end
|
29
31
|
```
|
30
32
|
|
31
|
-
[See the example Sinatra app for full examples](https://github.com/
|
33
|
+
[See the example Sinatra app for full examples](https://github.com/simi/omniauth-facebook/blob/master/example/config.ru) of both the server and client-side flows (including using the Facebook Javascript SDK).
|
32
34
|
|
33
35
|
## Configuring
|
34
36
|
|
@@ -39,7 +41,7 @@ Option name | Default | Explanation
|
|
39
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/
|
40
42
|
`display` | `page` | The display context to show the authentication page. Options are: `page`, `popup` and `touch`. Read the Facebook docs for more details: https://developers.facebook.com/docs/reference/dialogs/oauth/
|
41
43
|
`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.
|
42
|
-
`info_fields` |
|
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).
|
43
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/.
|
44
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`.
|
45
47
|
`secure_image_url` | `false` | Set to `true` to use https for the avatar image url returned in the auth hash.
|
@@ -49,21 +51,21 @@ For example, to request `email`, `user_birthday` and `read_stream` permissions a
|
|
49
51
|
|
50
52
|
```ruby
|
51
53
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
52
|
-
provider :facebook, ENV['
|
53
|
-
|
54
|
+
provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'],
|
55
|
+
scope: 'email,user_birthday,read_stream', display: 'popup'
|
54
56
|
end
|
55
57
|
```
|
56
58
|
|
57
59
|
### API Version
|
58
60
|
|
59
|
-
OmniAuth Facebook uses versioned API endpoints by default (current
|
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):
|
60
62
|
|
61
63
|
```ruby
|
62
64
|
use OmniAuth::Builder do
|
63
|
-
provider :facebook, ENV['
|
65
|
+
provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'],
|
64
66
|
client_options: {
|
65
|
-
site: 'https://graph.facebook.com/
|
66
|
-
authorize_url: "https://www.facebook.com/
|
67
|
+
site: 'https://graph.facebook.com/v7.0',
|
68
|
+
authorize_url: "https://www.facebook.com/v7.0/dialog/oauth"
|
67
69
|
}
|
68
70
|
end
|
69
71
|
```
|
@@ -86,8 +88,6 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
|
86
88
|
first_name: 'Joe',
|
87
89
|
last_name: 'Bloggs',
|
88
90
|
image: 'http://graph.facebook.com/1234567/picture?type=square',
|
89
|
-
urls: { Facebook: 'http://www.facebook.com/jbloggs' },
|
90
|
-
location: 'Palo Alto, California',
|
91
91
|
verified: true
|
92
92
|
},
|
93
93
|
credentials: {
|
@@ -109,7 +109,8 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
|
109
109
|
timezone: -8,
|
110
110
|
locale: 'en_US',
|
111
111
|
verified: true,
|
112
|
-
updated_time: '2011-11-11T06:21:03+0000'
|
112
|
+
updated_time: '2011-11-11T06:21:03+0000',
|
113
|
+
# ...
|
113
114
|
}
|
114
115
|
}
|
115
116
|
}
|
@@ -151,9 +152,7 @@ If you use the server-side flow, Facebook will give you back a longer lived acce
|
|
151
152
|
|
152
153
|
## Supported Rubies
|
153
154
|
|
154
|
-
- Ruby MRI (
|
155
|
-
- JRuby (1.9 mode)
|
156
|
-
- RBX (2.1.1+)
|
155
|
+
- Ruby MRI (2.3, 2.4, 2.5, 2.6)
|
157
156
|
|
158
157
|
## License
|
159
158
|
|
data/example/Gemfile.lock
CHANGED
@@ -1,54 +1,57 @@
|
|
1
1
|
PATH
|
2
|
-
remote:
|
2
|
+
remote: ..
|
3
3
|
specs:
|
4
|
-
omniauth-facebook (
|
4
|
+
omniauth-facebook (6.0.0)
|
5
5
|
omniauth-oauth2 (~> 1.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
backports (3.
|
11
|
-
faraday (0.
|
10
|
+
backports (3.15.0)
|
11
|
+
faraday (1.0.0)
|
12
12
|
multipart-post (>= 1.2, < 3)
|
13
|
-
hashie (3.
|
14
|
-
jwt (
|
15
|
-
multi_json (1.
|
16
|
-
multi_xml (0.
|
17
|
-
multipart-post (2.
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
hashie (3.6.0)
|
14
|
+
jwt (2.2.1)
|
15
|
+
multi_json (1.14.1)
|
16
|
+
multi_xml (0.6.0)
|
17
|
+
multipart-post (2.1.1)
|
18
|
+
mustermann (1.1.1)
|
19
|
+
ruby2_keywords (~> 0.0.1)
|
20
|
+
oauth2 (1.4.2)
|
21
|
+
faraday (>= 0.8, < 2.0)
|
22
|
+
jwt (>= 1.0, < 3.0)
|
21
23
|
multi_json (~> 1.3)
|
22
24
|
multi_xml (~> 0.5)
|
23
25
|
rack (>= 1.2, < 3)
|
24
|
-
omniauth (1.
|
25
|
-
hashie (>=
|
26
|
-
rack (>= 1.
|
27
|
-
omniauth-oauth2 (1.
|
28
|
-
oauth2 (~> 1.
|
29
|
-
omniauth (~> 1.
|
30
|
-
rack (1.
|
31
|
-
rack-protection (
|
26
|
+
omniauth (1.9.0)
|
27
|
+
hashie (>= 3.4.6, < 3.7.0)
|
28
|
+
rack (>= 1.6.2, < 3)
|
29
|
+
omniauth-oauth2 (1.6.0)
|
30
|
+
oauth2 (~> 1.1)
|
31
|
+
omniauth (~> 1.9)
|
32
|
+
rack (2.1.1)
|
33
|
+
rack-protection (2.0.8.1)
|
32
34
|
rack
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
rack (~>
|
37
|
-
rack-protection (
|
38
|
-
tilt (
|
39
|
-
sinatra-contrib (
|
40
|
-
backports (>= 2.
|
35
|
+
ruby2_keywords (0.0.2)
|
36
|
+
sinatra (2.0.8.1)
|
37
|
+
mustermann (~> 1.0)
|
38
|
+
rack (~> 2.0)
|
39
|
+
rack-protection (= 2.0.8.1)
|
40
|
+
tilt (~> 2.0)
|
41
|
+
sinatra-contrib (2.0.8.1)
|
42
|
+
backports (>= 2.8.2)
|
41
43
|
multi_json
|
42
|
-
|
43
|
-
rack-
|
44
|
-
sinatra (
|
45
|
-
tilt (
|
44
|
+
mustermann (~> 1.0)
|
45
|
+
rack-protection (= 2.0.8.1)
|
46
|
+
sinatra (= 2.0.8.1)
|
47
|
+
tilt (~> 2.0)
|
46
48
|
sinatra-reloader (1.0)
|
47
49
|
sinatra-contrib
|
48
|
-
tilt (2.0.
|
50
|
+
tilt (2.0.10)
|
49
51
|
|
50
52
|
PLATFORMS
|
51
53
|
ruby
|
54
|
+
x64-mingw32
|
52
55
|
|
53
56
|
DEPENDENCIES
|
54
57
|
omniauth-facebook!
|
@@ -56,4 +59,4 @@ DEPENDENCIES
|
|
56
59
|
sinatra-reloader
|
57
60
|
|
58
61
|
BUNDLED WITH
|
59
|
-
1.
|
62
|
+
1.17.2
|
data/example/app.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'sinatra'
|
2
2
|
require "sinatra/reloader"
|
3
3
|
require 'yaml'
|
4
|
+
require 'json'
|
4
5
|
|
5
6
|
# configure sinatra
|
6
7
|
set :run, false
|
@@ -27,8 +28,8 @@ get '/client-side' do
|
|
27
28
|
<script type="text/javascript">
|
28
29
|
window.fbAsyncInit = function() {
|
29
30
|
FB.init({
|
30
|
-
appId: '#{ENV['
|
31
|
-
version: '
|
31
|
+
appId: '#{ENV['FACEBOOK_APP_ID']}',
|
32
|
+
version: 'v4.0',
|
32
33
|
cookie: true // IMPORTANT must enable cookies to allow the server to access the session
|
33
34
|
});
|
34
35
|
console.log("fb init");
|
@@ -81,5 +82,5 @@ end
|
|
81
82
|
# - ajax request made here for client-side flow
|
82
83
|
get '/auth/:provider/callback' do
|
83
84
|
content_type 'application/json'
|
84
|
-
|
85
|
+
JSON.dump(request.env)
|
85
86
|
end
|
data/example/config.ru
CHANGED
@@ -12,8 +12,8 @@ module OmniAuth
|
|
12
12
|
DEFAULT_SCOPE = 'email'
|
13
13
|
|
14
14
|
option :client_options, {
|
15
|
-
site: 'https://graph.facebook.com/
|
16
|
-
authorize_url: "https://www.facebook.com/
|
15
|
+
site: 'https://graph.facebook.com/v4.0',
|
16
|
+
authorize_url: "https://www.facebook.com/v4.0/dialog/oauth",
|
17
17
|
token_url: 'oauth/access_token'
|
18
18
|
}
|
19
19
|
|
@@ -22,6 +22,8 @@ module OmniAuth
|
|
22
22
|
param_name: 'access_token'
|
23
23
|
}
|
24
24
|
|
25
|
+
option :authorization_code_from_signed_request_in_cookie, nil
|
26
|
+
|
25
27
|
option :authorize_options, [:scope, :display, :auth_type]
|
26
28
|
|
27
29
|
uid { raw_info['id'] }
|
@@ -76,7 +78,7 @@ module OmniAuth
|
|
76
78
|
# phase and it must match during the access_token phase:
|
77
79
|
# https://github.com/facebook/facebook-php-sdk/blob/master/src/base_facebook.php#L477
|
78
80
|
def callback_url
|
79
|
-
if
|
81
|
+
if options.authorization_code_from_signed_request_in_cookie
|
80
82
|
''
|
81
83
|
else
|
82
84
|
# Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7
|
@@ -131,7 +133,7 @@ module OmniAuth
|
|
131
133
|
yield
|
132
134
|
elsif code_from_signed_request = signed_request_from_cookie && signed_request_from_cookie['code']
|
133
135
|
request.params['code'] = code_from_signed_request
|
134
|
-
|
136
|
+
options.authorization_code_from_signed_request_in_cookie = true
|
135
137
|
# NOTE The code from the signed fbsr_XXX cookie is set by the FB JS SDK will confirm that the identity of the
|
136
138
|
# user contained in the signed request matches the user loading the app.
|
137
139
|
original_provider_ignores_state = options.provider_ignores_state
|
@@ -140,7 +142,7 @@ module OmniAuth
|
|
140
142
|
yield
|
141
143
|
ensure
|
142
144
|
request.params.delete('code')
|
143
|
-
|
145
|
+
options.authorization_code_from_signed_request_in_cookie = false
|
144
146
|
options.provider_ignores_state = original_provider_ignores_state
|
145
147
|
end
|
146
148
|
else
|
@@ -159,13 +161,15 @@ module OmniAuth
|
|
159
161
|
uri_class = options[:secure_image_url] ? URI::HTTPS : URI::HTTP
|
160
162
|
site_uri = URI.parse(client.site)
|
161
163
|
url = uri_class.build({host: site_uri.host, path: "#{site_uri.path}/#{uid}/picture"})
|
164
|
+
query = { access_token: access_token.token }
|
162
165
|
|
163
|
-
|
164
|
-
|
166
|
+
if options[:image_size].is_a?(String) || options[:image_size].is_a?(Symbol)
|
167
|
+
query[:type] = options[:image_size]
|
165
168
|
elsif options[:image_size].is_a?(Hash)
|
166
|
-
options[:image_size]
|
169
|
+
query.merge!(options[:image_size])
|
167
170
|
end
|
168
|
-
|
171
|
+
|
172
|
+
url.query = Rack::Utils.build_query(query)
|
169
173
|
|
170
174
|
url.to_s
|
171
175
|
end
|
data/omniauth-facebook.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ['Mark Dodwell', 'Josef Šimánek']
|
9
9
|
s.email = ['mark@madeofcode.com', 'retro@ballgag.cz']
|
10
10
|
s.summary = 'Facebook OAuth2 Strategy for OmniAuth'
|
11
|
-
s.homepage = 'https://github.com/
|
11
|
+
s.homepage = 'https://github.com/simi/omniauth-facebook'
|
12
12
|
s.license = 'MIT'
|
13
13
|
|
14
14
|
s.files = `git ls-files`.split("\n")
|
data/test/helper.rb
CHANGED
@@ -41,6 +41,7 @@ class StrategyTestCase < TestCase
|
|
41
41
|
|
42
42
|
@client_id = '123'
|
43
43
|
@client_secret = '53cr3tz'
|
44
|
+
@options = {}
|
44
45
|
end
|
45
46
|
|
46
47
|
def strategy
|
@@ -53,4 +54,4 @@ class StrategyTestCase < TestCase
|
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
56
|
-
Dir[File.expand_path('../support/**/*', __FILE__)].each
|
57
|
+
Dir[File.expand_path('../support/**/*', __FILE__)].each(&method(:require))
|
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 'https://graph.facebook.com/
|
12
|
+
assert_equal 'https://graph.facebook.com/v4.0', strategy.client.site
|
13
13
|
end
|
14
14
|
|
15
15
|
test 'has correct authorize url' do
|
16
|
-
assert_equal 'https://www.facebook.com/
|
16
|
+
assert_equal 'https://www.facebook.com/v4.0/dialog/oauth', strategy.client.options[:authorize_url]
|
17
17
|
end
|
18
18
|
|
19
19
|
test 'has correct token url with versioning' do
|
@@ -95,41 +95,52 @@ class UidTest < StrategyTestCase
|
|
95
95
|
end
|
96
96
|
|
97
97
|
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
|
+
|
98
104
|
test 'returns the secure facebook avatar url when `secure_image_url` option is specified' do
|
99
105
|
@options = { secure_image_url: true }
|
100
106
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
101
107
|
strategy.stubs(:raw_info).returns(raw_info)
|
102
|
-
|
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']
|
103
110
|
end
|
104
111
|
|
105
112
|
test 'returns the image_url based of the client site' do
|
106
113
|
@options = { secure_image_url: true, client_options: {site: "https://blah.facebook.com/v2.2"}}
|
107
114
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
108
115
|
strategy.stubs(:raw_info).returns(raw_info)
|
109
|
-
|
116
|
+
strategy.stubs(:access_token).returns(@access_token)
|
117
|
+
assert_equal "https://blah.facebook.com/v2.2/321/picture?access_token=test_access_token", strategy.info['image']
|
110
118
|
end
|
111
119
|
|
112
120
|
test 'returns the image with size specified in the `image_size` option' do
|
113
121
|
@options = { image_size: 'normal' }
|
114
122
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
115
123
|
strategy.stubs(:raw_info).returns(raw_info)
|
116
|
-
|
124
|
+
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']
|
117
126
|
end
|
118
127
|
|
119
128
|
test 'returns the image with size specified as a symbol in the `image_size` option' do
|
120
129
|
@options = { image_size: :normal }
|
121
130
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
122
131
|
strategy.stubs(:raw_info).returns(raw_info)
|
123
|
-
|
132
|
+
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']
|
124
134
|
end
|
125
135
|
|
126
136
|
test 'returns the image with width and height specified in the `image_size` option' do
|
127
137
|
@options = { image_size: { width: 123, height: 987 } }
|
128
138
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
129
139
|
strategy.stubs(:raw_info).returns(raw_info)
|
140
|
+
strategy.stubs(:access_token).returns(@access_token)
|
130
141
|
assert_match 'width=123', strategy.info['image']
|
131
142
|
assert_match 'height=987', strategy.info['image']
|
132
|
-
assert_match 'http://graph.facebook.com/
|
143
|
+
assert_match 'http://graph.facebook.com/v4.0/321/picture?access_token=test_access_token', strategy.info['image']
|
133
144
|
end
|
134
145
|
end
|
135
146
|
|
@@ -138,6 +149,10 @@ class InfoTestOptionalDataPresent < StrategyTestCase
|
|
138
149
|
super
|
139
150
|
@raw_info ||= { 'name' => 'Fred Smith' }
|
140
151
|
strategy.stubs(:raw_info).returns(@raw_info)
|
152
|
+
|
153
|
+
access_token = stub('OAuth2::AccessToken')
|
154
|
+
access_token.stubs(:token).returns('test_access_token')
|
155
|
+
strategy.stubs(:access_token).returns(access_token)
|
141
156
|
end
|
142
157
|
|
143
158
|
test 'returns the name' do
|
@@ -176,7 +191,7 @@ class InfoTestOptionalDataPresent < StrategyTestCase
|
|
176
191
|
|
177
192
|
test 'returns the facebook avatar url' do
|
178
193
|
@raw_info['id'] = '321'
|
179
|
-
assert_equal 'http://graph.facebook.com/
|
194
|
+
assert_equal 'http://graph.facebook.com/v4.0/321/picture?access_token=test_access_token', strategy.info['image']
|
180
195
|
end
|
181
196
|
|
182
197
|
test 'returns the Facebook link as the Facebook url' do
|
@@ -215,6 +230,10 @@ class InfoTestOptionalDataNotPresent < StrategyTestCase
|
|
215
230
|
super
|
216
231
|
@raw_info ||= { 'name' => 'Fred Smith' }
|
217
232
|
strategy.stubs(:raw_info).returns(@raw_info)
|
233
|
+
|
234
|
+
access_token = stub('OAuth2::AccessToken')
|
235
|
+
access_token.stubs(:token).returns('test_access_token')
|
236
|
+
strategy.stubs(:access_token).returns(access_token)
|
218
237
|
end
|
219
238
|
|
220
239
|
test 'has no email key' do
|
@@ -258,7 +277,7 @@ class RawInfoTest < StrategyTestCase
|
|
258
277
|
@options = {appsecret_proof: @appsecret_proof, fields: 'name,email'}
|
259
278
|
end
|
260
279
|
|
261
|
-
test 'performs a GET to https://graph.facebook.com/
|
280
|
+
test 'performs a GET to https://graph.facebook.com/v4.0/me' do
|
262
281
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
263
282
|
strategy.stubs(:access_token).returns(@access_token)
|
264
283
|
params = {params: @options}
|
@@ -266,7 +285,7 @@ class RawInfoTest < StrategyTestCase
|
|
266
285
|
strategy.raw_info
|
267
286
|
end
|
268
287
|
|
269
|
-
test 'performs a GET to https://graph.facebook.com/
|
288
|
+
test 'performs a GET to https://graph.facebook.com/v4.0/me with locale' do
|
270
289
|
@options.merge!({ locale: 'cs_CZ' })
|
271
290
|
strategy.stubs(:access_token).returns(@access_token)
|
272
291
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
@@ -275,7 +294,7 @@ class RawInfoTest < StrategyTestCase
|
|
275
294
|
strategy.raw_info
|
276
295
|
end
|
277
296
|
|
278
|
-
test 'performs a GET to https://graph.facebook.com/
|
297
|
+
test 'performs a GET to https://graph.facebook.com/v4.0/me with info_fields' do
|
279
298
|
@options.merge!({info_fields: 'about'})
|
280
299
|
strategy.stubs(:access_token).returns(@access_token)
|
281
300
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
@@ -284,7 +303,7 @@ class RawInfoTest < StrategyTestCase
|
|
284
303
|
strategy.raw_info
|
285
304
|
end
|
286
305
|
|
287
|
-
test 'performs a GET to https://graph.facebook.com/
|
306
|
+
test 'performs a GET to https://graph.facebook.com/v4.0/me with default info_fields' do
|
288
307
|
strategy.stubs(:access_token).returns(@access_token)
|
289
308
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
290
309
|
params = {params: {appsecret_proof: @appsecret_proof, fields: 'name,email'}}
|
@@ -452,7 +471,7 @@ module SignedRequestTests
|
|
452
471
|
end
|
453
472
|
|
454
473
|
test 'empty param' do
|
455
|
-
|
474
|
+
assert_nil strategy.send(:signed_request_from_cookie)
|
456
475
|
end
|
457
476
|
end
|
458
477
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-facebook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Dodwell
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-10-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-oauth2
|
@@ -75,6 +75,7 @@ executables: []
|
|
75
75
|
extensions: []
|
76
76
|
extra_rdoc_files: []
|
77
77
|
files:
|
78
|
+
- ".github/workflows/stale.yml"
|
78
79
|
- ".gitignore"
|
79
80
|
- ".travis.yml"
|
80
81
|
- CHANGELOG.md
|
@@ -97,7 +98,7 @@ files:
|
|
97
98
|
- test/signed_request_test.rb
|
98
99
|
- test/strategy_test.rb
|
99
100
|
- test/support/shared_examples.rb
|
100
|
-
homepage: https://github.com/
|
101
|
+
homepage: https://github.com/simi/omniauth-facebook
|
101
102
|
licenses:
|
102
103
|
- MIT
|
103
104
|
metadata: {}
|
@@ -112,12 +113,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
113
|
version: '0'
|
113
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
115
|
requirements:
|
115
|
-
- - "
|
116
|
+
- - ">="
|
116
117
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
118
|
+
version: '0'
|
118
119
|
requirements: []
|
119
|
-
|
120
|
-
rubygems_version: 2.4.5.1
|
120
|
+
rubygems_version: 3.2.0.pre1
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Facebook OAuth2 Strategy for OmniAuth
|