#Why is `phx.gen.auth --live` has a controller?

2 messages · Page 1 of 1 (latest)

small ivy
#

In particular, I wonder why does it handle login/logout in a controller outside LiveView, where it handles many other requests in LiveView. Is it okay to build a whole app in LiveView, without a controller?

  scope "/", FederWeb do
    pipe_through [:browser, :redirect_if_account_is_authenticated]

    live_session ... do
      live ...
      live ...
      live ...
      live ...
    end
    # Why is this not LiveView?
    post "/account/log_in", AccountSessionController, :create
  end
thin mist
#

because the only way to set a cookie for the log in session is through an http request, not through a websocket.