Skip to content

feat(api): complete /api/v1 auth via host callbacks#91

Merged
mpge merged 1 commit into
masterfrom
feat/api-auth
Jun 25, 2026
Merged

feat(api): complete /api/v1 auth via host callbacks#91
mpge merged 1 commit into
masterfrom
feat/api-auth

Conversation

@mpge

@mpge mpge commented Jun 25, 2026

Copy link
Copy Markdown
Member

Completes the general /api/v1 to the Flutter auth contract, using the host-callback model (dependency-free — no password hashing or session store in the package).

What

  • Escalated.Api.HostAuth — resolves and invokes host-configured callbacks: api_authenticator, api_registrar, api_token_validator, api_token_refresher, api_profile_updater, api_logout. Normalizes results to {:ok, map} / {:error, reason} (422) / :unauthorized (401) / :not_configured (501).
  • AuthController — now serves the full contract: POST /auth/login, /auth/register, /auth/logout, /auth/refresh, GET /auth/me, PATCH /auth/profile (plus the pre-existing POST /auth/validate, response shape preserved). Bearer token read from the Authorization header.
  • Routes registered in the /api/v1 scope.

Why host-callback

The host app owns user identity. Delegating keeps Escalated free of any auth dependency and avoids assuming a credential store — the package stays a drop-in across hosts.

Verification

  • mix format clean; mix credo --strictno issues on changed files (the CI lint gate).
  • New Escalated.Api.HostAuthTest — 7 tests (delegation, not-configured 501 path, error/unauthorized mapping, logout no-op + callback invocation).
  • Full suite: 512 tests, 0 failures (was 505).

Extend the general JSON API auth to the full Flutter contract:
login, register, logout, refresh, me, and profile (validate already
existed). All credential handling is delegated to host-app callbacks via
a new Escalated.Api.HostAuth module — Escalated ships no password-hashing
or session dependency. The host configures api_authenticator /
api_registrar / api_token_validator / api_token_refresher /
api_profile_updater / api_logout; unconfigured endpoints return 501.
@mpge
mpge merged commit 2d90216 into master Jun 25, 2026
1 check passed
@mpge
mpge deleted the feat/api-auth branch June 25, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant