Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rescue OAuth2 Timeout errors #166

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the errors we are rescuing are introduced in version 2.0.2 of omniauth this seemed like a good update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rejecting 2.1+?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nov Good point, this is somewhat inflexible, isn't it? Maybe we should change to:

 gem.add_dependency "omniauth",   "~> 2.0.2, "~> 2.1"

Not sure if this is valid syntax for a gemspec but could give it a try

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify like we do oauth2 above

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and I realized you should specify v2.0.2 of oauth2 gem, not omniauth.


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

Expand Down