Skip to content

Commit cec0655

Browse files
committed
Had the logic flipped
1 parent 3af5f94 commit cec0655

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/omniauth/strategies/oauth2.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ def token_params
8383

8484
def callback_phase # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
8585
error = request.params["error_reason"] || request.params["error"]
86-
if error
87-
fail!(error, CallbackError.new(request.params["error"], request.params["error_description"] || request.params["error_reason"], request.params["error_uri"]))
88-
elsif !options.provider_ignores_state && (request.params["state"].to_s.empty? || !secure_compare(request.params["state"], session.delete("omniauth.state")))
86+
if !options.provider_ignores_state && (request.params["state"].to_s.empty? || !secure_compare(request.params["state"], session.delete("omniauth.state")))
8987
fail!(:csrf_detected, CallbackError.new(:csrf_detected, "CSRF detected"))
88+
elsif error
89+
fail!(error, CallbackError.new(request.params["error"], request.params["error_description"] || request.params["error_reason"], request.params["error_uri"]))
9090
else
9191
self.access_token = build_access_token
9292
self.access_token = access_token.refresh! if access_token.expired?

0 commit comments

Comments
 (0)