omniauth-facebook 1.0.0.rc2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of omniauth-facebook might be problematic. Click here for more details.
- data/.travis.yml +1 -0
- data/Gemfile +0 -2
- data/README.md +78 -8
- data/example/config.ru +1 -1
- data/lib/omniauth/facebook/version.rb +1 -1
- data/lib/omniauth/strategies/facebook.rb +2 -0
- data/spec/omniauth/strategies/facebook_spec.rb +1 -1
- metadata +17 -11
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,30 +2,100 @@
|
|
2
2
|
|
3
3
|
This gem contains the Facebook strategy for OmniAuth 1.0.
|
4
4
|
|
5
|
+
Supports the OAuth 2.0 server-side flow. Read the Facebook docs for more details: http://developers.facebook.com/docs/authentication
|
6
|
+
|
5
7
|
## Installing
|
6
8
|
|
7
9
|
Add to your `Gemfile`:
|
8
10
|
|
9
11
|
```ruby
|
10
|
-
gem 'omniauth-facebook'
|
12
|
+
gem 'omniauth-facebook'
|
11
13
|
```
|
12
14
|
|
13
15
|
Then `bundle install`.
|
14
16
|
|
15
|
-
##
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
`OmniAuth::Strategies::Facebook` is simply a Rack middleware. Read the OmniAuth 1.0 docs for detailed instructions: https://github.com/intridea/omniauth.
|
20
|
+
|
21
|
+
Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
25
|
+
provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
## Configuring
|
30
|
+
|
31
|
+
You can configure several options, which you pass in to the `provider` method via a `Hash`:
|
32
|
+
|
33
|
+
* `scope`: A comma-separated list of permissions you want to request from the user. See the Facebook docs for a full list of available permissions: http://developers.facebook.com/docs/reference/api/permissions. Default: `email,offline_access`
|
34
|
+
* `display`: The display context to show the authentication page. Options are: `page`, `popup`, `iframe`, `touch` and `wap`. Read the Facebook docs for more details: http://developers.facebook.com/docs/reference/dialogs#display. Default: `page`
|
16
35
|
|
17
|
-
|
18
|
-
|
36
|
+
For example, to request `email`, `offline_access` and `read_stream` permissions and display the authentication page in a popup window:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
40
|
+
provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'], :scope => 'email,offline_access,read_stream', :display => 'popup'
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
*NB.* If you want to set the `display` format on a per-request basis, you can just pass it to the OmniAuth request phase URL, for example: `/auth/facebook?display=popup`.
|
45
|
+
|
46
|
+
## Authentication Hash
|
47
|
+
|
48
|
+
Here's an example *Authentication Hash* available in `request.env['omniauth.auth']`:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
{
|
52
|
+
:provider => 'facebook',
|
53
|
+
:uid => '1234567',
|
54
|
+
:info => {
|
55
|
+
:nickname => 'jbloggs',
|
56
|
+
:email => 'joe@bloggs.com',
|
57
|
+
:name => 'Joe Bloggs',
|
58
|
+
:first_name => 'Joe',
|
59
|
+
:last_name => 'Bloggs',
|
60
|
+
:image => 'http://graph.facebook.com/1234567/picture?type=square',
|
61
|
+
:urls => { :Facebook => 'http://www.facebook.com/jbloggs' },
|
62
|
+
:location => 'Palo Alto, California'
|
63
|
+
},
|
64
|
+
:credentials => {
|
65
|
+
:token => 'ABCDEF...', # OAuth 2.0 access_token, which you may wish to store
|
66
|
+
:expires_at => 1321747205, # when the access token expires (if it expires)
|
67
|
+
:expires => true # if you request `offline_access` this will be false
|
68
|
+
},
|
69
|
+
:extra => {
|
70
|
+
:raw_info => {
|
71
|
+
:id => '1234567',
|
72
|
+
:name => 'Joe Bloggs',
|
73
|
+
:first_name => 'Joe',
|
74
|
+
:last_name => 'Bloggs',
|
75
|
+
:link => 'http://www.facebook.com/jbloggs',
|
76
|
+
:username => 'jbloggs',
|
77
|
+
:location => { :id => '123456789', :name => 'Palo Alto, California' },
|
78
|
+
:gender => 'male',
|
79
|
+
:email => 'joe@bloggs.com',
|
80
|
+
:timezone => -8,
|
81
|
+
:locale => 'en_US',
|
82
|
+
:verified => true,
|
83
|
+
:updated_time => '2011-11-11T06:21:03+0000'
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
```
|
19
88
|
|
20
|
-
|
89
|
+
The precise information available may depend on the permissions which you request.
|
21
90
|
|
22
|
-
##
|
91
|
+
## Supported Rubies
|
23
92
|
|
24
|
-
|
93
|
+
Actively tested with the following Ruby versions:
|
25
94
|
|
95
|
+
- MRI 1.9.3
|
26
96
|
- MRI 1.9.2
|
27
97
|
- MRI 1.8.7
|
28
|
-
- JRuby 1.6.
|
98
|
+
- JRuby 1.6.5
|
29
99
|
|
30
100
|
## License
|
31
101
|
|
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', :display => 'popup'
|
25
25
|
end
|
26
26
|
|
27
27
|
run App.new
|
@@ -219,7 +219,7 @@ describe OmniAuth::Strategies::Facebook do
|
|
219
219
|
end
|
220
220
|
|
221
221
|
it 'returns the refresh token and expiry time when expiring' do
|
222
|
-
ten_mins_from_now = (Time.now +
|
222
|
+
ten_mins_from_now = (Time.now + 600).to_i
|
223
223
|
@access_token.stub(:expires?) { true }
|
224
224
|
@access_token.stub(:refresh_token) { '321' }
|
225
225
|
@access_token.stub(:expires_at) { ten_mins_from_now }
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-facebook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mark Dodwell
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-oauth2
|
16
|
-
requirement: &
|
16
|
+
requirement: &70230182116160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70230182116160
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70230182114320 !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: *70230182114320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70230182112600 !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: *70230182112600
|
47
47
|
description:
|
48
48
|
email:
|
49
49
|
- mark@mkdynamic.co.uk
|
@@ -78,12 +78,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
78
|
- - ! '>='
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
hash: -728790844477512045
|
81
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
85
|
none: false
|
83
86
|
requirements:
|
84
|
-
- - ! '
|
87
|
+
- - ! '>='
|
85
88
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
89
|
+
version: '0'
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
hash: -728790844477512045
|
87
93
|
requirements: []
|
88
94
|
rubyforge_project:
|
89
95
|
rubygems_version: 1.8.10
|