I am signing in users using:
def sign_in(conn, params) do
with %User{} = user <- Repo.get_by(User, email: params["email"], provider: "db") do
with {:ok, token, _claims} <- Accounts.authenticate(%{user: user, password: params["password"]}) do
conn = Mango.Guardian.Plug.sign_in(conn, user, %{key: token})
json conn, %{authinticated: "true", logged_in_as: user.email, institute_id: user.institute_id, expires_at: _claims["exp"]}
end
end
end
The cookie is set on the browser, however all subsequent requests to protected paths return error 401
. Any idea what might be going on here? Thank you.