Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OmniAuth Invalid Response Error

I'm using OmniAuth with Devise to allow users to login with facebook or to create a normal account with a username and password. When I originally set it all up I used the excellent directions from Railscasts. Everything was working very nicely for 2+ months but just the other day the facebook login stopped working. OmniAuth sends you away to the authentication with facebook and then returns with: http://localhost:3000/auth/failure?message=invalid_response

Google has no suggestions on what causes this error or how to fix it and the OmniAuth docs don't either. I've tried digging through their code as well but the only mention of this error I've found is this, in /oa-oauth/lib/omniauth/strategies/oauth.rb:

rescue ::MultiJson::DecodeError => e
  fail!(:invalid_response, e)
end

Has anyone ever seen this error!? Know what it is or how to fix it?! This is keeping me from launching this application so any help would be very very appreciated!

Thanks, JG

like image 861
erskingardner Avatar asked Mar 06 '26 22:03

erskingardner


1 Answers

I've been running into this error in the same situation. Devise is rescuing an unrelated Exception and handling it as an auth failure. I preempted Devise by handling the exception in the controller:

  # authentications_controller.rb
  def create
    omniauth = request.env["omniauth.auth"]
    # Blah
    # blah
    # Blark!
  rescue Exception => e
    # Just spit out the error message and a backtrace.
    render :text => "<html><body><pre>" + e.to_s + "</pre><hr /><pre>" + e.backtrace.join("\n") + "</pre></body></html>"
like image 53
Dean Brundage Avatar answered Mar 08 '26 13:03

Dean Brundage



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!