Skip to content

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

Merged
mpge merged 2 commits into
mainfrom
feat/api-auth
Jul 1, 2026
Merged

feat(api): complete /api/v1/auth contract via host callbacks#104
mpge merged 2 commits into
mainfrom
feat/api-auth

Conversation

@mpge

@mpge mpge commented Jul 1, 2026

Copy link
Copy Markdown
Member

Completes the general /api/v1 auth contract for Adonis — the last backend in the cross-backend sweep.

What

  • config.apiAuth host callbacks (authenticate / register / validate / refresh / updateProfile / logout) added to EscalatedConfig.
  • ApiAuthController gains login, register, logout, refresh, me, profile (joining the existing validate). Bearer token read from the Authorization header. Unconfigured callback → 501; null result → 401.
  • New endpoints registered in a public route group (skips AuthenticateApiToken, since they carry no token yet); validate stays in the token-authed group.

Verification

  • tsc --noEmit clean; eslint (the lint CI gate) clean (formatted with the locked prettier 3.8.5).
  • New tests/unit/api_auth_controller.spec.ts — 5 tests (501 not-configured, delegation, 401 null, me forwards bearer token, logout always-200).

mpge added 2 commits June 30, 2026 21:40
Extend the API auth controller from validate to the full Flutter contract:
login, register, logout, refresh, me, profile. Credential handling is
delegated to host-app callbacks (config.apiAuth.*) — Escalated owns no
passwords or sessions. The new endpoints live in a public route group (no
API-token middleware) since they carry no token yet; an unconfigured
callback responds 501, a null result is an auth failure (401).
The controller unit spec imported the controller, whose runtime
'../../helpers/config.js' import cannot be resolved by CI's native
'node --test tests/unit/*.spec.ts' leg (no tsx deep .js->.ts resolution).

Extract the callback delegation + bearer parsing into a pure
src/helpers/api_auth.ts (no runtime imports) that the controller reuses,
and unit-test that helper directly. Same 501/401/200 host-callback
contract, now runnable under the native test runner.
@mpge mpge merged commit bb3b3d1 into main Jul 1, 2026
4 checks passed
@mpge mpge deleted the feat/api-auth branch July 1, 2026 01:47
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