Module: Unmagic::Passkeys::Rails::Routes

Defined in:
lib/unmagic/passkeys/rails/routes.rb

Overview

Adds use_unmagic_passkeys to the router. Draws the multi-user passkey auth flows pointing at the engine's base controllers (which your app may subclass and re-point):

resource  :session,  only: [:new, :create, :destroy]   # sign-in page + ceremony + sign-out
resources :passkeys, only: [:index, :create, :destroy] # management, mounted at /my/passkeys

Sign-in is usernameless (discoverable credentials), so it works for any number of users out of the box. Account creation (signup) is the app's job — see the README.

Usage

# config/routes.rb
use_unmagic_passkeys

# Customize: re-point a flow at your own controller, skip flows, or
# nest everything under a path scope.
use_unmagic_passkeys scope: "accounts" do
controllers sessions: "sessions", credentials: "my/passkeys"
skip_controllers :credentials
end

Defined Under Namespace

Modules: Mapper Classes: Mapping

Constant Summary collapse

DEFAULT_CONTROLLERS =
{
  sessions: "unmagic/passkeys/sessions",
  credentials: "unmagic/passkeys/credentials"
}.freeze