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

Do NOT check for OAuthException code #627

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions lib/koala/api/graph_error_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ def initialize(http_status, body, headers)
@headers = headers
end

# Facebook has a set of standardized error codes, some of which represent problems with the
# token.
AUTHENTICATION_ERROR_CODES = [102, 190, 450, 452, 2500]

# Facebook can return debug information in the response headers -- see
# https://developers.facebook.com/docs/graph-api/using-graph-api#bugdebug
DEBUG_HEADERS = ["x-fb-debug", "x-fb-rev", "x-fb-trace-id"]
Expand All @@ -38,10 +34,7 @@ def error_class
end

def auth_error?
# tbh, I'm not sure why we restrict Facebook-reported OAuthExceptions to only those without
# codes or whose codes match the list above -- let's investigate changing this later.
error_info['type'] == 'OAuthException' &&
(!error_info['code'] || AUTHENTICATION_ERROR_CODES.include?(error_info['code'].to_i))
error_info['type'] == 'OAuthException'
end

def error_info
Expand Down
11 changes: 0 additions & 11 deletions spec/cases/graph_error_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
module Koala
module Facebook
RSpec.describe GraphErrorChecker do
it "defines a set of AUTHENTICATION_ERROR_CODES" do
expect(GraphErrorChecker::AUTHENTICATION_ERROR_CODES).to match_array([102, 190, 450, 452, 2500])
end

it "defines a set of DEBUG_HEADERS" do
expect(GraphErrorChecker::DEBUG_HEADERS).to match_array([
"x-fb-rev",
Expand Down Expand Up @@ -95,13 +91,6 @@ module Facebook
body.replace({"error" => {"type" => "OAuthException"}}.to_json)
expect(error).to be_an(AuthenticationError)
end

GraphErrorChecker::AUTHENTICATION_ERROR_CODES.each do |error_code|
it "if FB says it's an OAuthException and it has code #{error_code}" do
body.replace({"error" => {"type" => "OAuthException", "code" => error_code}}.to_json)
expect(error).to be_an(AuthenticationError)
end
end
end

# Note: I'm not sure why this behavior was implemented, it may be incorrect. To
Expand Down