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

login_url_with_scope/2 function not used #38

Closed nelsonic closed 4 years ago

nelsonic commented 4 years ago

The login_url_with_scope/2 function is not used in the package anywhere and the only project that uses this package https://github.com/dwyl/library does not invoke it anywhere: https://github.com/dwyl/library/search?q=login_url_with_scope&unscoped_q=login_url_with_scope image Only the login_url_with_scope/1 is invoked on /lib/library_web/controllers/login_controller.ex#L17

an org-wide search for the invocation: https://github.com/search?q=org%3Adwyl+login_url_with_scope&type=Code shows no usage.

So given that we are not using it. I'm removing it.

The definition is just:

  @doc """
    `login_url_with_scope/2` appends state to login_url_with_scope/1.
    Returns URL.
  """
  def login_url_with_scope(scopes, state) do
    login_url_with_scope(scopes) <> "&state=#{state}"
  end

and the test is:

  test "test login_url_with_scope_state/2 with all valid inputs" do
    url = "https://github.com/login/oauth/authorize?client_id="
      <> client_id() <> "&scope=user%20user:email&state=hello"
    scopes = ["user", "user:email"]
    assert ElixirAuthGithub.login_url_with_scope(scopes, "hello") == url
  end

So we can always restore it if we discover that it's needed.

nelsonic commented 4 years ago

Removed in #34