767 B · text History b9a6d14
defmodule DiogramosWeb.MagicLinkController do
  @moduledoc """
  The shared landing point for magic-link emails sent to native clients.

  The Android app registers an App Link on `https://<host>/m/:token`. When
  the OS routes the URL to the app, the app redeems the token through
  `POST /api/v1/sessions/redeem` and this controller is never reached.

  When the same link is opened in a browser — App Links unverified, a
  desktop, a different phone — it lands here and is handed to the existing
  web login flow. One URL in the email either way, because at send time
  there is no way to know where it will be opened.
  """
  use DiogramosWeb, :controller

  def show(conn, %{"token" => token}) do
    redirect(conn, to: ~p"/users/log-in/#{token}")
  end
end