Skip to content

Question on authentication #115

@asok

Description

@asok

Hi,
first things first - I'm really a newbie in Elixir and Phoenix.

I wanted to use live_admin behind authentication. I've configured it and run mix phx.gen.auth Administration Admin admins.
I've setup the router like so:

  scope "/", WowWeb do
    pipe_through [:browser, :require_authenticated_admin]

    live_session :require_authenticated_admin,
      on_mount: [{WowWeb.AdminAuth, :ensure_authenticated}] do
      live "/admins/settings", AdminSettingsLive, :edit
      live "/admins/settings/confirm_email/:token", AdminSettingsLive, :confirm_email
    end

    live_admin "/admin", title: "Wow Project"  do
      admin_resource "/users", Wow.Admin.User
    end
  end

Two questions:

  • is this the right way to do auth?
  • if yes, how can I place the "log out" link in the live layout? phx.gen.auth generate layouts under components/layouts/ dir. But it seems that live_admin is using it's own layouts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions