mix ash_openfeed.install (AshOpenFeed v0.1.0)

Copy Markdown View Source

Sets up AshOpenFeed in a Phoenix + Ash application.

What it generates

  • MyApp.OpenFeed — an Ash domain for the OpenFeed resources.
  • MyApp.OpenFeed.Grant — the grant resource, with the extension applied.
  • MyApp.OpenFeed.Key — the signing key resource, so keys are shared across nodes rather than generated per node.
  • MyAppWeb.OpenFeedController — the consent flow. Generated, not library-owned, because what happens after a successful grant — which user to attach it to, where to redirect, what to flash — is inherently application-specific. Edit it freely.
  • Routes for /openfeed/connect and /openfeed/callback.
  • config :my_app, :openfeed, ... in runtime.exs.

Usage

mix igniter.install ash_openfeed

Options

  • --repo — the Ecto repo for the generated resources. Inferred if there is only one.
  • --domain — the Ash domain module to generate. Defaults to MyApp.OpenFeed.
  • --user-resource — add a belongs_to to this resource on the grant, and wire the controller to attach grants to conn.assigns.current_user.
  • --no-controller — skip the controller and routes.

After running

  1. Generate migrations: mix ash.codegen install_ash_openfeed

  2. Run them: mix ash.migrate

  3. Generate a signing key and register it with OpenFeed:

    mix openfeed.gen.key --print
    # insert into MyApp.OpenFeed.Key, then:
    mix openfeed.jwks --path ...
  4. Set OPENFEED_CLIENT_ID and register the redirect URI at https://app.openfeed.au/registered-apps.