forked from mooktakim/devise_oauth2_facebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
38 lines (24 loc) · 1.1 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Only Rails 3 is supported.
Uses fbgraph (http://github.com/nsanta/fbgraph)
Could use the Oauth2 gem directly, but it is more than likely that you
would want to use other features of facebook (ie post feed updates).
How to use
----------
Setup devise (http://github.com/plataformatec/devise), use Rails 3
Include the gem in Gemfile after devise:
gem 'devise'
gem 'devise_oauth2_facebook'
Include the ':devise_oauth2_facebook' in your model:
devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable, :devise_oauth2_facebook
Add the following config options:
$ config/initializers/devise.rb
config.facebook_api_key = "KEY"
config.facebook_api_secret = "SECRET"
config.facebook_permissions = 'offline_access,email,publish_stream'
Good minimum to have is "offline_access,email"
Create a migration file to add the columns:
add_column :users, :facebook_uid, :string
add_column :users, :facebook_token, :string
Finally, update your view to include "Login with facebook" link:
<%= link_to "Login with facebook", user_fb_auth_path %>