1
votes

I'm following the steps in Ryan Bates Railscaast #235, however, I'm trying to integrate Facebook instead of twitter.

GemFile

gem "omniauth-facebook", :git => "git://github.com/mkdynamic/omniauth-facebook.git"

Authentication Controller

 def create
   render :text => request.env["rack.auth"].to_yaml
  end

Omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, 'ID', 'Secret'
end

Routes

  devise_for :users

  resources :authentications
    match '/auth/:provider/callback' => 'authentications#create'

I'm testing this using http://localhost:3000 and have this designated as my facebook web site URL. When I enter localhost:3000/auth/facebook I'm prompted by facebook successfully, however, I'm redirected to: http://localhost:3000/auth/facebook/callback?code= and the following page content:

--- !!null ...

My question is where is at least the facebook email address? Or as a noob am I missing something?

1

1 Answers

1
votes

In your Authentication Controller, change the following line:

render :text => request.env["rack.auth"].to_yaml

to

render :text => request.env["omniauth.auth"].to_yaml

Also take a look at RailsCast Episode 241 - Simple OmniAuth which Ryan Bates has updated to work with OmniAuth 1.0