def log_in_user(conn, user) do
strategy = AshAuthentication.Info.strategy!(MyApp.Accounts.User, :magic_link)
{:ok, token} = AshAuthentication.Strategy.MagicLink.request_token_for(strategy, user)
user = Accounts.sign_in_with_magic_link!(%{token: token}, authorize?: false)
conn
|> Phoenix.ConnTest.init_test_session(%{})
|> AshAuthentication.Plug.Helpers.store_in_session(user)
end
def log_in_user(conn, user) do
strategy = AshAuthentication.Info.strategy!(MyApp.Accounts.User, :magic_link)
{:ok, token} = AshAuthentication.Strategy.MagicLink.request_token_for(strategy, user)
user = Accounts.sign_in_with_magic_link!(%{token: token}, authorize?: false)
conn
|> Phoenix.ConnTest.init_test_session(%{})
|> AshAuthentication.Plug.Helpers.store_in_session(user)
end