Permalink
Browse files

Catch JSON parsing errors in OAuth strategies. Closes #158

  • Loading branch information...
Michael Bleigh
Michael Bleigh committed Feb 4, 2011
1 parent 61e64c3 commit 99d0faded7dcde6e3babce4704cfd777fd73bc6e
Showing with 4 additions and 0 deletions.
  1. +2 −0 oa-oauth/lib/omniauth/strategies/oauth.rb
  2. +2 −0 oa-oauth/lib/omniauth/strategies/oauth2.rb
@@ -48,6 +48,8 @@ def callback_phase
super
rescue ::OAuth::Unauthorized => e
fail!(:invalid_credentials, e)
+ rescue ::MultiJson::DecodeError => e
+ fail!(:invalid_response, e)
end
def auth_hash
@@ -79,6 +79,8 @@ def callback_phase
super
rescue ::OAuth2::HTTPError, ::OAuth2::AccessDenied, CallbackError => e
fail!(:invalid_credentials, e)
+ rescue ::MultiJson::DecodeError => e
+ fail!(:invalid_response, e)
end
def auth_hash

1 comment on commit 99d0fad

Hello. I believe this commit introduced a bug in that the gemspec here: https://github.com/intridea/omniauth/blob/master/oa-oauth/oa-oauth.gemspec is requiring multi_json v.0.0.2 which as you can see here: https://github.com/intridea/multi_json/tree/v0.0.2 does not support the MultiJson::DecodeError object which is not available until this commit in v.0.0.5: intridea/multi_json@dea9a1a

Please sign in to comment.