lib/omniauth/strategies/surveymonkey.rb in surveymonkey-with-omniauth-1.1.0 vs lib/omniauth/strategies/surveymonkey.rb in surveymonkey-with-omniauth-1.1.1
- old
+ new
@@ -31,9 +31,15 @@
def callback_phase
options[:client_options][:token_url] = "/oauth/token?api_key=#{options[:api_key]}"
self.access_token = build_access_token
self.env['omniauth.auth'] = auth_hash
call_app!
+ rescue ::OAuth2::Error, CallbackError => e
+ fail!(:invalid_credentials, e)
+ rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
+ fail!(:timeout, e)
+ rescue ::SocketError => e
+ fail!(:failed_to_connect, e)
end
def token_params
super.tap do |params|
params[:grant_type] ||= DEFAULT_GRANT