dimanche 29 mars 2015

Rails 4 OmniAuth-Facebook request.env return nil

I have an application that uses Rails 4, OmniAuth and OmniAuth-facebook and in the controller action "request.env['omniauth.auth']" is nil.


GemFile



gem 'omniauth'
gem 'omniauth-facebook' # Facebook authentication
gem 'omniauth-twitter' #twitter authentication
gem "koala", "~> 1.10.0rc" # Facebook API
...


config/initializers/omniauth.rb



Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, FACEBOOK_CONFIG['app_id'].to_s, FACEBOOK_CONFIG['secret'].to_s, {:scope => 'xmpp_login'}
provider :twitter, '8v3vAAc0k878b#######'
end


Controller:



class SomeController
def index
raise env["omniauth.auth"].inspect
end
...


The result is simply: 'nil'


What is missing?


Aucun commentaire:

Enregistrer un commentaire