omniauth-facebook 5.0.0 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +28 -0
- data/.github/workflows/stale.yml +23 -0
- data/CHANGELOG.md +24 -0
- data/Gemfile +1 -5
- data/README.md +12 -12
- data/example/Gemfile.lock +38 -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 +16 -9
- data/omniauth-facebook.gemspec +1 -1
- data/test/helper.rb +4 -1
- data/test/strategy_test.rb +48 -14
- metadata +10 -10
- data/.travis.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
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
|
@@ -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/CHANGELOG.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
## 9.0.0 (2021-10-25)
|
2
|
+
|
3
|
+
Changes:
|
4
|
+
|
5
|
+
- bumped version of FB Graph API to v5.0
|
6
|
+
|
7
|
+
## 8.0.0 (2020-10-20)
|
8
|
+
|
9
|
+
Changes:
|
10
|
+
|
11
|
+
- user profile picture link includes access token (#344, @anklos)
|
12
|
+
|
13
|
+
## 7.0.0 (2020-08-03)
|
14
|
+
|
15
|
+
Changes:
|
16
|
+
|
17
|
+
- bumped version of FB Graph API to v4.0
|
18
|
+
|
19
|
+
## 6.0.0 (2020-01-27)
|
20
|
+
|
21
|
+
Changes:
|
22
|
+
|
23
|
+
- bumped version of FB Graph API to v3.0
|
24
|
+
|
1
25
|
## 5.0.0 (2018-03-29)
|
2
26
|
|
3
27
|
Changes:
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# OmniAuth Facebook [![Build Status](https://secure.travis-ci.org/
|
1
|
+
# OmniAuth Facebook [![Build Status](https://secure.travis-ci.org/simi/omniauth-facebook.svg?branch=master)](https://travis-ci.org/simi/omniauth-facebook) [![Gem Version](https://img.shields.io/gem/v/omniauth-facebook.svg)](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
|
|
@@ -26,11 +26,11 @@ Here's a quick example, adding the middleware to a Rails app in `config/initiali
|
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
29
|
-
provider :facebook, ENV['
|
29
|
+
provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET']
|
30
30
|
end
|
31
31
|
```
|
32
32
|
|
33
|
-
[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).
|
34
34
|
|
35
35
|
## Configuring
|
36
36
|
|
@@ -41,31 +41,31 @@ Option name | Default | Explanation
|
|
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
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/
|
43
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.
|
44
|
-
`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).
|
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:
|
51
51
|
|
52
52
|
```ruby
|
53
53
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
54
|
-
provider :facebook, ENV['
|
54
|
+
provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'],
|
55
55
|
scope: 'email,user_birthday,read_stream', display: 'popup'
|
56
56
|
end
|
57
57
|
```
|
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
|
65
|
-
provider :facebook, ENV['
|
65
|
+
provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'],
|
66
66
|
client_options: {
|
67
|
-
site: 'https://graph.facebook.com/
|
68
|
-
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"
|
69
69
|
}
|
70
70
|
end
|
71
71
|
```
|
@@ -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.0
|
155
|
+
- Ruby MRI (2.5, 2.6, 2.7, 3.0)
|
156
156
|
|
157
157
|
## License
|
158
158
|
|
data/example/Gemfile.lock
CHANGED
@@ -1,54 +1,58 @@
|
|
1
1
|
PATH
|
2
|
-
remote:
|
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
|
-
backports (3.
|
11
|
-
faraday (
|
10
|
+
backports (3.15.0)
|
11
|
+
faraday (1.1.0)
|
12
12
|
multipart-post (>= 1.2, < 3)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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)
|
21
24
|
multi_json (~> 1.3)
|
22
25
|
multi_xml (~> 0.5)
|
23
26
|
rack (>= 1.2, < 3)
|
24
|
-
omniauth (1.
|
25
|
-
hashie (>=
|
26
|
-
rack (>= 1.
|
27
|
-
omniauth-oauth2 (1.
|
28
|
-
oauth2 (~> 1.
|
29
|
-
omniauth (~> 1.
|
30
|
-
rack (
|
31
|
-
rack-protection (
|
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)
|
32
35
|
rack
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
rack (~>
|
37
|
-
rack-protection (
|
38
|
-
tilt (
|
39
|
-
sinatra-contrib (
|
40
|
-
backports (>= 2.
|
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)
|
41
44
|
multi_json
|
42
|
-
|
43
|
-
rack-
|
44
|
-
sinatra (
|
45
|
-
tilt (
|
45
|
+
mustermann (~> 1.0)
|
46
|
+
rack-protection (= 2.0.8.1)
|
47
|
+
sinatra (= 2.0.8.1)
|
48
|
+
tilt (~> 2.0)
|
46
49
|
sinatra-reloader (1.0)
|
47
50
|
sinatra-contrib
|
48
|
-
tilt (2.0.
|
51
|
+
tilt (2.0.10)
|
49
52
|
|
50
53
|
PLATFORMS
|
51
54
|
ruby
|
55
|
+
x64-mingw32
|
52
56
|
|
53
57
|
DEPENDENCIES
|
54
58
|
omniauth-facebook!
|
@@ -56,4 +60,4 @@ DEPENDENCIES
|
|
56
60
|
sinatra-reloader
|
57
61
|
|
58
62
|
BUNDLED WITH
|
59
|
-
1.
|
63
|
+
1.17.3
|
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
@@ -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
|
|
@@ -22,8 +23,12 @@ module OmniAuth
|
|
22
23
|
param_name: 'access_token'
|
23
24
|
}
|
24
25
|
|
26
|
+
option :authorization_code_from_signed_request_in_cookie, nil
|
27
|
+
|
25
28
|
option :authorize_options, [:scope, :display, :auth_type]
|
26
29
|
|
30
|
+
option :secure_image_url, true
|
31
|
+
|
27
32
|
uid { raw_info['id'] }
|
28
33
|
|
29
34
|
info do
|
@@ -76,7 +81,7 @@ module OmniAuth
|
|
76
81
|
# phase and it must match during the access_token phase:
|
77
82
|
# https://github.com/facebook/facebook-php-sdk/blob/master/src/base_facebook.php#L477
|
78
83
|
def callback_url
|
79
|
-
if
|
84
|
+
if options.authorization_code_from_signed_request_in_cookie
|
80
85
|
''
|
81
86
|
else
|
82
87
|
# Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7
|
@@ -131,7 +136,7 @@ module OmniAuth
|
|
131
136
|
yield
|
132
137
|
elsif code_from_signed_request = signed_request_from_cookie && signed_request_from_cookie['code']
|
133
138
|
request.params['code'] = code_from_signed_request
|
134
|
-
|
139
|
+
options.authorization_code_from_signed_request_in_cookie = true
|
135
140
|
# NOTE The code from the signed fbsr_XXX cookie is set by the FB JS SDK will confirm that the identity of the
|
136
141
|
# user contained in the signed request matches the user loading the app.
|
137
142
|
original_provider_ignores_state = options.provider_ignores_state
|
@@ -140,7 +145,7 @@ module OmniAuth
|
|
140
145
|
yield
|
141
146
|
ensure
|
142
147
|
request.params.delete('code')
|
143
|
-
|
148
|
+
options.authorization_code_from_signed_request_in_cookie = false
|
144
149
|
options.provider_ignores_state = original_provider_ignores_state
|
145
150
|
end
|
146
151
|
else
|
@@ -159,13 +164,15 @@ module OmniAuth
|
|
159
164
|
uri_class = options[:secure_image_url] ? URI::HTTPS : URI::HTTP
|
160
165
|
site_uri = URI.parse(client.site)
|
161
166
|
url = uri_class.build({host: site_uri.host, path: "#{site_uri.path}/#{uid}/picture"})
|
167
|
+
query = { access_token: access_token.token }
|
162
168
|
|
163
|
-
|
164
|
-
|
169
|
+
if options[:image_size].is_a?(String) || options[:image_size].is_a?(Symbol)
|
170
|
+
query[:type] = options[:image_size]
|
165
171
|
elsif options[:image_size].is_a?(Hash)
|
166
|
-
options[:image_size]
|
172
|
+
query.merge!(options[:image_size])
|
167
173
|
end
|
168
|
-
|
174
|
+
|
175
|
+
url.query = Rack::Utils.build_query(query)
|
169
176
|
|
170
177
|
url.to_s
|
171
178
|
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,9 @@ class StrategyTestCase < TestCase
|
|
41
41
|
|
42
42
|
@client_id = '123'
|
43
43
|
@client_secret = '53cr3tz'
|
44
|
+
@options = {}
|
45
|
+
|
46
|
+
@facebook_api_version = OmniAuth::Strategies::Facebook::DEFAULT_FACEBOOK_API_VERSION
|
44
47
|
end
|
45
48
|
|
46
49
|
def strategy
|
@@ -53,4 +56,4 @@ class StrategyTestCase < TestCase
|
|
53
56
|
end
|
54
57
|
end
|
55
58
|
|
56
|
-
Dir[File.expand_path('../support/**/*', __FILE__)].each
|
59
|
+
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
|
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
|
@@ -95,41 +95,67 @@ class UidTest < StrategyTestCase
|
|
95
95
|
end
|
96
96
|
|
97
97
|
class InfoTest < StrategyTestCase
|
98
|
-
|
98
|
+
def setup
|
99
|
+
super
|
100
|
+
@access_token = stub('OAuth2::AccessToken')
|
101
|
+
@access_token.stubs(:token).returns('test_access_token')
|
102
|
+
end
|
103
|
+
|
104
|
+
test 'returns the secure facebook avatar url when `secure_image_url` option is set to true' 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/#{@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']
|
103
125
|
end
|
104
126
|
|
105
127
|
test 'returns the image_url based of the client site' do
|
106
128
|
@options = { secure_image_url: true, client_options: {site: "https://blah.facebook.com/v2.2"}}
|
107
129
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
108
130
|
strategy.stubs(:raw_info).returns(raw_info)
|
109
|
-
|
131
|
+
strategy.stubs(:access_token).returns(@access_token)
|
132
|
+
assert_equal "https://blah.facebook.com/v2.2/321/picture?access_token=test_access_token", strategy.info['image']
|
110
133
|
end
|
111
134
|
|
112
135
|
test 'returns the image with size specified in the `image_size` option' do
|
113
136
|
@options = { image_size: 'normal' }
|
114
137
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
115
138
|
strategy.stubs(:raw_info).returns(raw_info)
|
116
|
-
|
139
|
+
strategy.stubs(:access_token).returns(@access_token)
|
140
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token&type=normal", strategy.info['image']
|
117
141
|
end
|
118
142
|
|
119
143
|
test 'returns the image with size specified as a symbol in the `image_size` option' do
|
120
144
|
@options = { image_size: :normal }
|
121
145
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
122
146
|
strategy.stubs(:raw_info).returns(raw_info)
|
123
|
-
|
147
|
+
strategy.stubs(:access_token).returns(@access_token)
|
148
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token&type=normal", strategy.info['image']
|
124
149
|
end
|
125
150
|
|
126
151
|
test 'returns the image with width and height specified in the `image_size` option' do
|
127
152
|
@options = { image_size: { width: 123, height: 987 } }
|
128
153
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
129
154
|
strategy.stubs(:raw_info).returns(raw_info)
|
155
|
+
strategy.stubs(:access_token).returns(@access_token)
|
130
156
|
assert_match 'width=123', strategy.info['image']
|
131
157
|
assert_match 'height=987', strategy.info['image']
|
132
|
-
assert_match
|
158
|
+
assert_match "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
133
159
|
end
|
134
160
|
end
|
135
161
|
|
@@ -138,6 +164,10 @@ class InfoTestOptionalDataPresent < StrategyTestCase
|
|
138
164
|
super
|
139
165
|
@raw_info ||= { 'name' => 'Fred Smith' }
|
140
166
|
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)
|
141
171
|
end
|
142
172
|
|
143
173
|
test 'returns the name' do
|
@@ -176,7 +206,7 @@ class InfoTestOptionalDataPresent < StrategyTestCase
|
|
176
206
|
|
177
207
|
test 'returns the facebook avatar url' do
|
178
208
|
@raw_info['id'] = '321'
|
179
|
-
assert_equal
|
209
|
+
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
180
210
|
end
|
181
211
|
|
182
212
|
test 'returns the Facebook link as the Facebook url' do
|
@@ -215,6 +245,10 @@ class InfoTestOptionalDataNotPresent < StrategyTestCase
|
|
215
245
|
super
|
216
246
|
@raw_info ||= { 'name' => 'Fred Smith' }
|
217
247
|
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)
|
218
252
|
end
|
219
253
|
|
220
254
|
test 'has no email key' do
|
@@ -258,7 +292,7 @@ class RawInfoTest < StrategyTestCase
|
|
258
292
|
@options = {appsecret_proof: @appsecret_proof, fields: 'name,email'}
|
259
293
|
end
|
260
294
|
|
261
|
-
test
|
295
|
+
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me" do
|
262
296
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
263
297
|
strategy.stubs(:access_token).returns(@access_token)
|
264
298
|
params = {params: @options}
|
@@ -266,7 +300,7 @@ class RawInfoTest < StrategyTestCase
|
|
266
300
|
strategy.raw_info
|
267
301
|
end
|
268
302
|
|
269
|
-
test
|
303
|
+
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me with locale" do
|
270
304
|
@options.merge!({ locale: 'cs_CZ' })
|
271
305
|
strategy.stubs(:access_token).returns(@access_token)
|
272
306
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
@@ -275,7 +309,7 @@ class RawInfoTest < StrategyTestCase
|
|
275
309
|
strategy.raw_info
|
276
310
|
end
|
277
311
|
|
278
|
-
test
|
312
|
+
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me with info_fields" do
|
279
313
|
@options.merge!({info_fields: 'about'})
|
280
314
|
strategy.stubs(:access_token).returns(@access_token)
|
281
315
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
@@ -284,7 +318,7 @@ class RawInfoTest < StrategyTestCase
|
|
284
318
|
strategy.raw_info
|
285
319
|
end
|
286
320
|
|
287
|
-
test
|
321
|
+
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me with default info_fields" do
|
288
322
|
strategy.stubs(:access_token).returns(@access_token)
|
289
323
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
290
324
|
params = {params: {appsecret_proof: @appsecret_proof, fields: 'name,email'}}
|
@@ -452,7 +486,7 @@ module SignedRequestTests
|
|
452
486
|
end
|
453
487
|
|
454
488
|
test 'empty param' do
|
455
|
-
|
489
|
+
assert_nil strategy.send(:signed_request_from_cookie)
|
456
490
|
end
|
457
491
|
end
|
458
492
|
|
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,8 +75,9 @@ executables: []
|
|
75
75
|
extensions: []
|
76
76
|
extra_rdoc_files: []
|
77
77
|
files:
|
78
|
+
- ".github/workflows/ci.yml"
|
79
|
+
- ".github/workflows/stale.yml"
|
78
80
|
- ".gitignore"
|
79
|
-
- ".travis.yml"
|
80
81
|
- CHANGELOG.md
|
81
82
|
- Gemfile
|
82
83
|
- README.md
|
@@ -97,11 +98,11 @@ 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: {}
|
104
|
-
post_install_message:
|
105
|
+
post_install_message:
|
105
106
|
rdoc_options: []
|
106
107
|
require_paths:
|
107
108
|
- lib
|
@@ -116,9 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
117
|
- !ruby/object:Gem::Version
|
117
118
|
version: '0'
|
118
119
|
requirements: []
|
119
|
-
|
120
|
-
|
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:
|