dwyl / elixir-auth-github

:octocat: Minimalist GitHub OAuth Authentication for Elixir Apps. Tested, Documented & Maintained. Setup in 5 mins. 🚀
GNU General Public License v2.0
38 stars 4 forks source link

github_auth/2 function not used #39

Closed nelsonic closed 4 years ago

nelsonic commented 4 years ago

The github_auth/2 function is not used anywhere in @dwyl GitHub. https://github.com/search?q=org%3Adwyl+github_auth&type=Code

I don't understand why this function is needed ...

Code:

  @doc """
  Same as `github_auth/1` except it adds the state String returned from GitHub.
  """
  def github_auth(code, state) do
    case github_auth(code) do
      {:ok, user} ->
        {:ok, Map.put(user, "state", state)}
      error ->
        error
    end
  end

Tests:

test "Test github auth with state" do
    setup_test_environment_variables()

    assert ElixirAuthGithub.github_auth("12345", "hello") ==
             {:ok, %{"access_token" => "12345", "login" => "test_user", "state" => "hello"}}
  end

  test "test github auth failure with state" do
    setup_test_environment_variables()

    assert ElixirAuthGithub.github_auth("1234", "hello") ==
             {:error, %{"error" => "error"}}
  end

I don't understand why this function is required. And since it is not used by any of our projects. I'm removing it. ✂️

nelsonic commented 4 years ago

Removed in #34