From ff49001406031828405640d8f68bf11da601df3c Mon Sep 17 00:00:00 2001 From: Arno Dirlam Date: Sun, 27 Oct 2019 15:56:42 +0100 Subject: [PATCH 1/3] Fix client config precedence --- lib/ueberauth/strategy/twitter/oauth.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ueberauth/strategy/twitter/oauth.ex b/lib/ueberauth/strategy/twitter/oauth.ex index 7b3ae5b..1899159 100644 --- a/lib/ueberauth/strategy/twitter/oauth.ex +++ b/lib/ueberauth/strategy/twitter/oauth.ex @@ -54,8 +54,8 @@ defmodule Ueberauth.Strategy.Twitter.OAuth do config = Application.get_env(:ueberauth, __MODULE__) @defaults - |> Keyword.merge(config) |> Keyword.merge(opts) + |> Keyword.merge(config) |> Enum.into(%{}) end From 30f92063b512fcbcca96757fbb56683ecebf0cbd Mon Sep 17 00:00:00 2001 From: Arno Dirlam Date: Sun, 27 Oct 2019 16:20:14 +0100 Subject: [PATCH 2/3] Fix unused variable in decode_response --- lib/ueberauth/strategy/twitter/oauth.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ueberauth/strategy/twitter/oauth.ex b/lib/ueberauth/strategy/twitter/oauth.ex index 1899159..9d76ca7 100644 --- a/lib/ueberauth/strategy/twitter/oauth.ex +++ b/lib/ueberauth/strategy/twitter/oauth.ex @@ -93,7 +93,7 @@ defmodule Ueberauth.Strategy.Twitter.OAuth do {:ok, {token, token_secret}} end - defp decode_response({:ok, %{status_code: status_code, body: %{"errors" => [error | _]}}}) do + defp decode_response({:ok, %{body: %{"errors" => [error | _]}}}) do {:error, %ApiError{message: error["message"], code: error["code"]}} end From 5300229f5a062c4e49c9d5a24708c75c689d9f45 Mon Sep 17 00:00:00 2001 From: Arno Dirlam Date: Sun, 27 Oct 2019 17:36:02 +0100 Subject: [PATCH 3/3] Fix merging config values set to nil --- lib/ueberauth/strategy/twitter/oauth.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ueberauth/strategy/twitter/oauth.ex b/lib/ueberauth/strategy/twitter/oauth.ex index 9d76ca7..fb65052 100644 --- a/lib/ueberauth/strategy/twitter/oauth.ex +++ b/lib/ueberauth/strategy/twitter/oauth.ex @@ -55,10 +55,13 @@ defmodule Ueberauth.Strategy.Twitter.OAuth do @defaults |> Keyword.merge(opts) - |> Keyword.merge(config) + |> Keyword.merge(config, &merge_present_values/3) |> Enum.into(%{}) end + defp merge_present_values(_key, left, nil), do: left + defp merge_present_values(_key, _left, right), do: right + def get(url, access_token), do: get(url, [], access_token) def get(url, params, {token, token_secret}) do client()