Skip to content

Commit 24fa16d

Browse files
committed
AUTH-161 added additional logging on none 200 response for debugging purposes
1 parent ec60d86 commit 24fa16d

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v1.5.5
2+
- Add logging of an errored oauth2 response
3+
14
v1.5.4
25
- Fix a problem with fetching counts with the http_method_override: true option supplied.
36

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.4
1+
1.5.5

lib/spark_api/authentication/oauth2_impl/faraday_middleware.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ def initialize(app)
1515
def on_complete(env)
1616
body = MultiJson.decode(env[:body])
1717
SparkApi.logger.debug { "[oauth2] Response Body: #{body.inspect}" }
18+
1819
unless body.is_a?(Hash)
1920
raise InvalidResponse, "The server response could not be understood"
2021
end
22+
2123
case env[:status]
2224
when 200..299
2325
SparkApi.logger.debug{ "[oauth2] Success!" }
2426
session = OAuthSession.new(body)
25-
else
27+
else
28+
SparkApi.logger.warn { "[oauth2] failure #{body.inspect}" }
29+
2630
# Handle the WWW-Authenticate Response Header Field if present. This can be returned by
2731
# OAuth2 implementations and wouldn't hurt to log.
2832
auth_header_error = env[:request_headers]["WWW-Authenticate"]

0 commit comments

Comments
 (0)