I'm going through the Phoenix Guide on Sessions. It explains it very well how I can bind data to a session using put_session
and fetch the value later using get_session
but it doesn't tell how I can delete a User's session.
From the guide:
defmodule HelloPhoenix.PageController do
use Phoenix.Controller
def index(conn, _params) do
conn = put_session(conn, :message, "new stuff we just set in the session")
message = get_session(conn, :message)
text conn, message
end
end
Found it in the Plug Docs:
You can put something like this in your
SessionsController
:and add a route for this in your
web/router.ex
.