Skip to content

Question on authentication #115

Closed
Closed

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.

Activity

  1. changed the title [-]Question on how to properly authenticate[/-] [+]Question on authentication[/+] on Jul 18, 2024
  2. Repository owner locked and limited conversation to collaborators on Jul 19, 2024
  3. converted this issue into a discussion #116 on Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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