Step 1: FaceBook Application Integration
Visit http://developers.facebook.com/apps and click the ‘Create New App’ and fill the required fields and select a category and subcategory, click Continue.
After that, note application’s id and secret and click on ‘Website with Facebook Login’, here give a site URL i.e
http://localhost:3000 and Save.
Step 3:Now in rails app open gem file and add the below gem.
gem ‘omniauth-facebook’ and type $ bundle install in console
Step 4:Create initializer i.e omniauth in/initializers/omniauth.rb & edit as below
OmniAuth.config.logger = Rails.logger
Replace ‘facebook app id’ with your app id, and ‘ facebook app secret’ with values that was i mentioned above.For solving Open SSL , issue we have to download a file i.e download this file and put in rails application root folder.
Step 5:Next create a user model to save the data that retrieves from FaceBook i.e run the commands in console:
$rails g model user provider uid name oauth_token oauth_expires_at:datetime
Step 6:Home controller and sessions will allow user login & logout,So run the commands in the console.
$rails g controller home show
$rails g controller Sessions create destroy