Adding the user to the session

This commit is contained in:
2023-02-18 16:39:17 +00:00
parent e3a9f2f77e
commit 47c92ad44a
4 changed files with 32 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ defmodule PhoenixApiTemplateWeb.UserController do
case Guardian.authenticate(email, password) do
{:ok, user, token} ->
conn
|> Plug.Conn.put_session(:user_id, user.id)
|> put_status(:ok)
|> render("user_token.json", %{user: user, token: token})