lib/set_google_auth.ex

# TODO: ask eric about naming
defmodule PlugParadoxAuth.SetGoogleAuth do
  def init(options) do
    # initialize options
    options
  end

  def call(conn, %{params: %{code: code}}) do
    IO.inspect "PlugParadoxAuth.SetGoogleAuth.set_session"
    IO.inspect conn
    IO.puts code


    # Handle error case
    # make a git commit after profile comes back
    {:ok, token} = ElixirAuthGoogle.get_token(code, conn)
    {:ok, profile} = ElixirAuthGoogle.get_user_profile(token.access_token)
    IO.inspect profile

    conn
  end
end