Ash FrameworkAF
Ash Framework3y ago
7 replies
morfertaw

AshAuthenticationPhoenix controlling generated routes

I setup my phoenix app using the getting started with ash authentication guide. If I understand correctly adding routes works as follows:
  # Added for macros and functions
  use AshAuthentication.Phoenix.Router
  pipeline :browser do
    # ...
    # Plug to load session from cookie
    plug :load_from_session
  end
  scope "/", ExampleWeb do
    pipe_through :browser

    get "/", PageController, :home

    # Adds a liveview at /sign-in based on Example.Accounts.User
    sign_in_route()
    # Adds a sign out get route for signing out uses logic defined in AuthController
    sign_out_route AuthController
    # Adds a sign in and register route that the /sign-in liveview uses to login and/or register a user, also uses logic defined in AuthController plus data from Example.Accounts.User resource?
    auth_routes_for Example.Accounts.User, to: AuthController
    # Unused reset route
    reset_route []
  end

Would it be possible to remove the register route from auth_routes_for generation? I would like more control over how new users can register. Can the register page also be removed from the /sign-in liveview? I want to setup registration separately
Ash HQ
Read the "Getting Started With Ash Authentication Phoenix" guide on Ash HQ
Guide: Getting Started With Ash Authentication Phoenix
Was this page helpful?