I tried this:
def login_reply({:ok, user}, conn) do
put_flash(conn, :info, "Welcome back!")
new_conn = Guardian.Plug.sign_in(conn, Guaridan, user, %{}, [])
redirect(new_conn, to: "/secret")
end
def login_reply({:error, reason}, conn) do
conn
|> put_flash(:error, to_string(reason))
|> new(%{})
end
And, I got this warning:
~/phoenix_apps/dog$ mix phx.server
warning: function Dog.UserManager.Guardian.Plug.sign_in/5 is undefined or private. Did you mean one of:
* sign_in/2
* sign_in/3
* sign_in/4
lib/dog_web/controllers/session_controller.ex:28
...
...
In iex:
~/phoenix_apps/dog$ iex -S mix
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (1.8.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> h Guardian.Plug.sign_in
def sign_in(conn, impl, resource, claims \\ %{}, opts \\ [])
@spec sign_in(
Plug.Conn.t(),
module(),
any(),
Guardian.Token.claims(),
Guardian.options()
) :: Plug.Conn.t()
iex(2)>
That looks like 5 arguments to me! So, I decided to pick the two most important arguments, and go with that:
new_conn = Guardian.Plug.sign_in(conn, user)
That got rid of the Enumerable error. Now, I’ve got a routing error that I’m working on.






















