Skip to content

Commit

Permalink
Rescue OAuth2 Timeout errors
Browse files Browse the repository at this point in the history
* This fix was originally proposed with a different solution via this PR: #129
* The conclusion there was that we should not rescue Faraday errors because
  Faraday is not a direct dependency of OAuth2.
* Instead, best to rescue Faraday errors on OAuth2, then rescue OAuth2 errors here
* Those changes to OAuth2 were made here: https://gitlab.com/oauth-xx/oauth2/-/merge_requests/604
* And released as part of OAuth2 gem version 2.0.2: https://gitlab.com/oauth-xx/oauth2/-/blob/866dc365bfe0d64f6cc56295a38ccd5b24143836/CHANGELOG.md#L74
  • Loading branch information
jessieay committed Jun 5, 2023
1 parent 3a43234 commit fd7cb7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/omniauth/strategies/oauth2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def callback_phase # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexi
end
rescue ::OAuth2::Error, CallbackError => e
fail!(:invalid_credentials, e)
rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
rescue ::Timeout::Error, ::Errno::ETIMEDOUT, OAuth2::TimeoutError, OAuth2::ConnectionError => e
fail!(:timeout, e)
rescue ::SocketError => e
fail!(:failed_to_connect, e)
Expand Down
2 changes: 1 addition & 1 deletion omniauth-oauth2.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require "omniauth-oauth2/version"

Gem::Specification.new do |gem|
gem.add_dependency "oauth2", [">= 1.4", "< 3"]
gem.add_dependency "omniauth", "~> 2.0"
gem.add_dependency "omniauth", "~> 2.0.2"

gem.add_development_dependency "bundler", "~> 2.0"

Expand Down

0 comments on commit fd7cb7d

Please sign in to comment.