omniauth-facebook 5.0.0 β 6.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/stale.yml +23 -0
- data/.travis.yml +1 -3
- data/CHANGELOG.md +6 -0
- data/README.md +9 -9
- 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 +7 -5
- data/test/helper.rb +2 -1
- data/test/strategy_test.rb +12 -12
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b3b8b67acd7d8c1557f82b621f96931ce962e50567c1c0c0fde99c073ed9d662
|
4
|
+
data.tar.gz: cff801f45a35bbb51d51729fc3e90ffc0a58bb9a175e59274755e7785256165c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: badf485d3c8bdd1d6c3fa15de6e8524aa0421c365a571ce655f66c34d61270580fb9669c297652eb51c94c03111a52310a8a70813a6de88d95ea4e749a01c118
|
7
|
+
data.tar.gz: 0a064f3fc5060dfef9bee851e5188ba02c31fb62d3b07b4292699d8922059c5cf371825d94699f1b489a1a5c19c36a18024d92bdb5d79baa9b37d086c6e161b9
|
@@ -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
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
|
|
@@ -51,21 +51,21 @@ For example, to request `email`, `user_birthday` and `read_stream` permissions a
|
|
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 v3.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 v4.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/v4.0',
|
68
|
+
authorize_url: "https://www.facebook.com/v4.0/dialog/oauth"
|
69
69
|
}
|
70
70
|
end
|
71
71
|
```
|
@@ -152,7 +152,7 @@ If you use the server-side flow, Facebook will give you back a longer lived acce
|
|
152
152
|
|
153
153
|
## Supported Rubies
|
154
154
|
|
155
|
-
- Ruby MRI (2.
|
155
|
+
- Ruby MRI (2.3, 2.4, 2.5, 2.6)
|
156
156
|
|
157
157
|
## License
|
158
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: 'v3.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/v3.0',
|
16
|
+
authorize_url: "https://www.facebook.com/v3.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
|
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/v3.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/v3.0/dialog/oauth', strategy.client.options[:authorize_url]
|
17
17
|
end
|
18
18
|
|
19
19
|
test 'has correct token url with versioning' do
|
@@ -99,7 +99,7 @@ class InfoTest < StrategyTestCase
|
|
99
99
|
@options = { secure_image_url: true }
|
100
100
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
101
101
|
strategy.stubs(:raw_info).returns(raw_info)
|
102
|
-
assert_equal 'https://graph.facebook.com/
|
102
|
+
assert_equal 'https://graph.facebook.com/v3.0/321/picture', strategy.info['image']
|
103
103
|
end
|
104
104
|
|
105
105
|
test 'returns the image_url based of the client site' do
|
@@ -113,14 +113,14 @@ class InfoTest < StrategyTestCase
|
|
113
113
|
@options = { image_size: 'normal' }
|
114
114
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
115
115
|
strategy.stubs(:raw_info).returns(raw_info)
|
116
|
-
assert_equal 'http://graph.facebook.com/
|
116
|
+
assert_equal 'http://graph.facebook.com/v3.0/321/picture?type=normal', strategy.info['image']
|
117
117
|
end
|
118
118
|
|
119
119
|
test 'returns the image with size specified as a symbol in the `image_size` option' do
|
120
120
|
@options = { image_size: :normal }
|
121
121
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
122
122
|
strategy.stubs(:raw_info).returns(raw_info)
|
123
|
-
assert_equal 'http://graph.facebook.com/
|
123
|
+
assert_equal 'http://graph.facebook.com/v3.0/321/picture?type=normal', strategy.info['image']
|
124
124
|
end
|
125
125
|
|
126
126
|
test 'returns the image with width and height specified in the `image_size` option' do
|
@@ -129,7 +129,7 @@ class InfoTest < StrategyTestCase
|
|
129
129
|
strategy.stubs(:raw_info).returns(raw_info)
|
130
130
|
assert_match 'width=123', strategy.info['image']
|
131
131
|
assert_match 'height=987', strategy.info['image']
|
132
|
-
assert_match 'http://graph.facebook.com/
|
132
|
+
assert_match 'http://graph.facebook.com/v3.0/321/picture?', strategy.info['image']
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
@@ -176,7 +176,7 @@ class InfoTestOptionalDataPresent < StrategyTestCase
|
|
176
176
|
|
177
177
|
test 'returns the facebook avatar url' do
|
178
178
|
@raw_info['id'] = '321'
|
179
|
-
assert_equal 'http://graph.facebook.com/
|
179
|
+
assert_equal 'http://graph.facebook.com/v3.0/321/picture', strategy.info['image']
|
180
180
|
end
|
181
181
|
|
182
182
|
test 'returns the Facebook link as the Facebook url' do
|
@@ -258,7 +258,7 @@ class RawInfoTest < StrategyTestCase
|
|
258
258
|
@options = {appsecret_proof: @appsecret_proof, fields: 'name,email'}
|
259
259
|
end
|
260
260
|
|
261
|
-
test 'performs a GET to https://graph.facebook.com/
|
261
|
+
test 'performs a GET to https://graph.facebook.com/v3.0/me' do
|
262
262
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
263
263
|
strategy.stubs(:access_token).returns(@access_token)
|
264
264
|
params = {params: @options}
|
@@ -266,7 +266,7 @@ class RawInfoTest < StrategyTestCase
|
|
266
266
|
strategy.raw_info
|
267
267
|
end
|
268
268
|
|
269
|
-
test 'performs a GET to https://graph.facebook.com/
|
269
|
+
test 'performs a GET to https://graph.facebook.com/v3.0/me with locale' do
|
270
270
|
@options.merge!({ locale: 'cs_CZ' })
|
271
271
|
strategy.stubs(:access_token).returns(@access_token)
|
272
272
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
@@ -275,7 +275,7 @@ class RawInfoTest < StrategyTestCase
|
|
275
275
|
strategy.raw_info
|
276
276
|
end
|
277
277
|
|
278
|
-
test 'performs a GET to https://graph.facebook.com/
|
278
|
+
test 'performs a GET to https://graph.facebook.com/v3.0/me with info_fields' do
|
279
279
|
@options.merge!({info_fields: 'about'})
|
280
280
|
strategy.stubs(:access_token).returns(@access_token)
|
281
281
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
@@ -284,7 +284,7 @@ class RawInfoTest < StrategyTestCase
|
|
284
284
|
strategy.raw_info
|
285
285
|
end
|
286
286
|
|
287
|
-
test 'performs a GET to https://graph.facebook.com/
|
287
|
+
test 'performs a GET to https://graph.facebook.com/v3.0/me with default info_fields' do
|
288
288
|
strategy.stubs(:access_token).returns(@access_token)
|
289
289
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
290
290
|
params = {params: {appsecret_proof: @appsecret_proof, fields: 'name,email'}}
|
@@ -452,7 +452,7 @@ module SignedRequestTests
|
|
452
452
|
end
|
453
453
|
|
454
454
|
test 'empty param' do
|
455
|
-
|
455
|
+
assert_nil strategy.send(:signed_request_from_cookie)
|
456
456
|
end
|
457
457
|
end
|
458
458
|
|
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: 6.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-01-27 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
|
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
118
|
version: '0'
|
118
119
|
requirements: []
|
119
120
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.7.6.2
|
121
122
|
signing_key:
|
122
123
|
specification_version: 4
|
123
124
|
summary: Facebook OAuth2 Strategy for OmniAuth
|