I am very new to Elixir and Phoenix, I am trying to authenticate my application using {:comeonin, "~> 4.0"} and {:guardian, "~> 1.0"} and have a helper function that checks if the user is logged in:
defmodule Chatter.ViewHelper do
def current_user(conn), do: Guardian.Plug.current_resource(conn)
def logged_in?(conn) do
Guardian.Plug.authenticated?(conn)
end
end
But I get this error:
** (UndefinedFunctionError) function Guardian.Plug.authenticated?/1 is undefined or private.
Guardian documentation doesn't properly reference some API calls since the upgrade to
v1.0. You need to call these functions from your customMyApp.Guardianimplementation and not from the actualGuardianmodule(s).Assuming you followed the guide to implement
MyApp.Guardian, you need to call: