omniauth-facebook 1.0.0.rc1 → 1.0.0.rc2
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.
Potentially problematic release.
This version of omniauth-facebook might be problematic. Click here for more details.
- data/README.md +10 -2
- data/example/config.ru +1 -1
- data/lib/omniauth/facebook/version.rb +1 -1
- data/lib/omniauth/strategies/facebook.rb +9 -0
- data/omniauth-facebook.gemspec +1 -1
- data/spec/omniauth/strategies/facebook_spec.rb +17 -3
- metadata +9 -10
data/README.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# OmniAuth Facebook [](http://travis-ci.org/mkdynamic/omniauth-facebook)
|
2
2
|
|
3
|
-
|
3
|
+
This gem contains the Facebook strategy for OmniAuth 1.0.
|
4
4
|
|
5
|
-
|
5
|
+
## Installing
|
6
|
+
|
7
|
+
Add to your `Gemfile`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'omniauth-facebook', '~> 1.0.0.rc1'
|
11
|
+
```
|
12
|
+
|
13
|
+
Then `bundle install`.
|
6
14
|
|
7
15
|
## Supported Flows
|
8
16
|
|
data/example/config.ru
CHANGED
@@ -21,7 +21,7 @@ end
|
|
21
21
|
use Rack::Session::Cookie
|
22
22
|
|
23
23
|
use OmniAuth::Builder do
|
24
|
-
provider :facebook, ENV['APP_ID'], ENV['APP_SECRET'], :scope => 'email,read_stream'
|
24
|
+
provider :facebook, ENV['APP_ID'], ENV['APP_SECRET'], :scope => 'email,read_stream', :authorize_params => { :display => 'popup' }
|
25
25
|
end
|
26
26
|
|
27
27
|
run App.new
|
@@ -3,6 +3,8 @@ require 'omniauth/strategies/oauth2'
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
5
|
class Facebook < OmniAuth::Strategies::OAuth2
|
6
|
+
DEFAULT_SCOPE = 'email,offline_access'
|
7
|
+
|
6
8
|
option :client_options, {
|
7
9
|
:site => 'https://graph.facebook.com',
|
8
10
|
:token_url => '/oauth/access_token'
|
@@ -63,6 +65,13 @@ module OmniAuth
|
|
63
65
|
options.access_token_options.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }
|
64
66
|
end
|
65
67
|
|
68
|
+
def authorize_params
|
69
|
+
super.tap do |params|
|
70
|
+
params.merge!(:display => request.params['display']) if request.params['display']
|
71
|
+
params[:scope] ||= DEFAULT_SCOPE
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
66
75
|
private
|
67
76
|
|
68
77
|
def prune!(hash)
|
data/omniauth-facebook.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
16
16
|
s.require_paths = ['lib']
|
17
17
|
|
18
|
-
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.0.0
|
18
|
+
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.0.0'
|
19
19
|
|
20
20
|
s.add_development_dependency 'rspec', '~> 2.7.0'
|
21
21
|
s.add_development_dependency 'rake'
|
@@ -2,8 +2,15 @@ require 'spec_helper'
|
|
2
2
|
require 'omniauth-facebook'
|
3
3
|
|
4
4
|
describe OmniAuth::Strategies::Facebook do
|
5
|
+
before :each do
|
6
|
+
@request = double('Request')
|
7
|
+
@request.stub(:params) { {} }
|
8
|
+
end
|
9
|
+
|
5
10
|
subject do
|
6
|
-
OmniAuth::Strategies::Facebook.new(nil, @options || {})
|
11
|
+
OmniAuth::Strategies::Facebook.new(nil, @options || {}).tap do |strategy|
|
12
|
+
strategy.stub(:request) { @request }
|
13
|
+
end
|
7
14
|
end
|
8
15
|
|
9
16
|
it_should_behave_like 'an oauth2 strategy'
|
@@ -23,8 +30,15 @@ describe OmniAuth::Strategies::Facebook do
|
|
23
30
|
end
|
24
31
|
|
25
32
|
describe '#authorize_params' do
|
26
|
-
it '
|
27
|
-
subject.authorize_params.should
|
33
|
+
it 'includes default scope for email and offline access' do
|
34
|
+
subject.authorize_params.should be_a(Hash)
|
35
|
+
subject.authorize_params[:scope].should eq('email,offline_access')
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'includes display parameter from request when present' do
|
39
|
+
@request.stub(:params) { { 'display' => 'touch' } }
|
40
|
+
subject.authorize_params.should be_a(Hash)
|
41
|
+
subject.authorize_params[:display].should eq('touch')
|
28
42
|
end
|
29
43
|
end
|
30
44
|
|
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: 1.0.0.
|
4
|
+
version: 1.0.0.rc2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-11-11 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-oauth2
|
16
|
-
requirement: &
|
16
|
+
requirement: &70323804271400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.0.0
|
21
|
+
version: 1.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70323804271400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70323804270900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.7.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70323804270900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70323804270520 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70323804270520
|
47
47
|
description:
|
48
48
|
email:
|
49
49
|
- mark@mkdynamic.co.uk
|
@@ -94,4 +94,3 @@ test_files:
|
|
94
94
|
- spec/omniauth/strategies/facebook_spec.rb
|
95
95
|
- spec/spec_helper.rb
|
96
96
|
- spec/support/shared_examples.rb
|
97
|
-
has_rdoc:
|