jeudi 16 avril 2015

CSRF detected using OmniAuth-facebook, warden_ominiauth, warden run in cygwin

I been facing this problem recently. I receive this error in my browser.


enter image description here


In my cygwin it keep redirect me and end up showing



ERROR -- omniauth: (facebook) Authentication failure! csrf_detected:
OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detected
E, [2015-04-16T11:21:15.660929 #10056] ERROR -- omniauth: (facebook)
Authentication failure! invalid_credentials:
OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detecte


I tried various method suggested but failed to solve my problem.



After some testing, I think is my configuration problem but still have no idea how to fix it. It seem WardenOmniAuth could not receive the callback from facebook which keep looping and redirecting until the time spam killed it.


Here is my coding in my app.rb



failure = lambda{|e| Rack::Resposne.new("Can't login", 401).finish }

use Rack::Session::Cookie

use Warden::Manager do |config|
config.failure_app = failure
config.default_strategies :omni_facebook
end

use OmniAuth::Strategies::Facebook, ENV["APP_ID"], ENV["APP_SECRET"]

use WardenOmniAuth do |config|
config.redirect_after_callback = "/home"
end

Aucun commentaire:

Enregistrer un commentaire