diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 550ccdede..c6d801647 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1 +1,2 @@ OmniAuth.config.logger = Rails.logger +OmniAuth.config.full_host = URL.url diff --git a/spec/support/omniauth_helpers.rb b/spec/support/omniauth_helpers.rb index 484f06170..e2c369715 100644 --- a/spec/support/omniauth_helpers.rb +++ b/spec/support/omniauth_helpers.rb @@ -71,13 +71,14 @@ module OmniauthHelpers OmniAuth.config.mock_auth[provider] = :invalid_credentials end - def omniauth_setup_authentication_error(error) + def omniauth_setup_authentication_error(error, params = nil) # this hack is needed due to a limitation in how OmniAuth handles # failures in mocked/testing environments, # see # for more details local_failure_handler = lambda do |env| env["omniauth.error"] = error + env["omniauth.params"] = params unless params.nil? env end diff --git a/spec/system/authentication/user_logs_in_with_facebook_spec.rb b/spec/system/authentication/user_logs_in_with_facebook_spec.rb index 47e03fe66..d772e1d04 100644 --- a/spec/system/authentication/user_logs_in_with_facebook_spec.rb +++ b/spec/system/authentication/user_logs_in_with_facebook_spec.rb @@ -117,7 +117,7 @@ RSpec.describe "Authenticating with Facebook" do "Callback error", "Error reason", "https://example.com/error" ) - omniauth_setup_authentication_error(error) + omniauth_setup_authentication_error(error, params) visit sign_up_path click_link(sign_in_link, match: :first) @@ -133,7 +133,7 @@ RSpec.describe "Authenticating with Facebook" do allow(request).to receive(:code).and_return(401) allow(request).to receive(:message).and_return("unauthorized") error = OAuth::Unauthorized.new(request) - omniauth_setup_authentication_error(error) + omniauth_setup_authentication_error(error, params) visit sign_up_path click_link(sign_in_link, match: :first) @@ -146,7 +146,7 @@ RSpec.describe "Authenticating with Facebook" do it "notifies Datadog even with no OmniAuth error present" do error = nil - omniauth_setup_authentication_error(error) + omniauth_setup_authentication_error(error, params) visit sign_up_path click_link(sign_in_link, match: :first) diff --git a/spec/system/authentication/user_logs_in_with_github_spec.rb b/spec/system/authentication/user_logs_in_with_github_spec.rb index 723a88f10..d43ef379f 100644 --- a/spec/system/authentication/user_logs_in_with_github_spec.rb +++ b/spec/system/authentication/user_logs_in_with_github_spec.rb @@ -84,7 +84,7 @@ RSpec.describe "Authenticating with GitHub" do "Callback error", "Error reason", "https://example.com/error" ) - omniauth_setup_authentication_error(error) + omniauth_setup_authentication_error(error, params) visit sign_up_path click_link(sign_in_link, match: :first) @@ -100,7 +100,7 @@ RSpec.describe "Authenticating with GitHub" do allow(request).to receive(:code).and_return(401) allow(request).to receive(:message).and_return("unauthorized") error = OAuth::Unauthorized.new(request) - omniauth_setup_authentication_error(error) + omniauth_setup_authentication_error(error, params) visit sign_up_path click_link(sign_in_link, match: :first) @@ -113,7 +113,7 @@ RSpec.describe "Authenticating with GitHub" do it "notifies Datadog even with no OmniAuth error present" do error = nil - omniauth_setup_authentication_error(error) + omniauth_setup_authentication_error(error, params) visit sign_up_path click_link(sign_in_link, match: :first)