Skip to content

Commit

Permalink
Rewrote CodeCorps.GitHub so that access token request params are fetc…
Browse files Browse the repository at this point in the history
…hed at runtime
  • Loading branch information
begedin committed Oct 24, 2017
1 parent d6591ee commit 185db06
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions lib/code_corps/github/github.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
defmodule CodeCorps.GitHub do
alias CodeCorps.GitHub.API.Headers

@client_id Application.get_env(:code_corps, :github_app_client_id)
@client_secret Application.get_env(:code_corps, :github_app_client_secret)

@base_access_token_params %{
client_id: @client_id,
client_secret: @client_secret
}

defmodule APIErrorObject do
@moduledoc """
Represents an error object from the GitHub API.
Expand Down Expand Up @@ -168,8 +160,11 @@ defmodule CodeCorps.GitHub do

@spec build_access_token_params(String.t, String.t) :: map
defp build_access_token_params(code, state) do
@base_access_token_params
|> Map.put(:code, code)
|> Map.put(:state, state)
%{
client_id: Application.get_env(:code_corps, :github_app_client_id),
client_secret: Application.get_env(:code_corps, :github_app_client_secret),
code: code,
state: state
}
end
end

0 comments on commit 185db06

Please sign in to comment.