Skip to content

[On hold]: AuthExports has no sign-in/sign-out and auth denials cannot carry an app error envelope (fixed-contract adapters) #830

Closed as not planned

Description

@jimhoyd

Implementation on hold under #841. Do not expand the legacy export API for historical parity. Exercise the underlying application need through the embedded-auth proof #843. No backward compatibility is required. Re-scope or close this request after the replacement proves the need is covered.

Problem or use case

Found by the #828 compatibility audit; see the fixed-contract-adapter recipe README, "Compatibility audit". The recipe keeps auth in charge of sessions, but two mismatches with a fixed external JSON contract remain, and both sit on auth's side of the boundary.

  1. No sign-in or sign-out in AuthExports. A contract with POST /api/login returning {email, role} and POST /api/logout can't be served by an adapter without re-implementing what auth's /login and /logout handlers do around AuthService.login:

    • the flow CSRF token and origin check (http.verify);
    • abuse backoff (check, failure, clear);
    • the device cookie and new-device notice;
    • setting __Host-urlcode-session (http.sessionHeaders).

    The recipe makes clients call /account/csrf, then /account/login, then /api/me, and /account/logout.

  2. Auth's 401 and 403 can't carry an application's error envelope. They come from authorize() as {error: "<message>"}. [Request]: Keep fixed JSON APIs declarative when method denials need a JSON error envelope #821's site.errors deliberately never rewrites extension denials, and onDeny changes only the status. A fixed contract's {error: {code}} for signed-out or CSRF failures isn't possible, so clients must key on status.

Proposed behavior and alternatives

This may be deliberate; the owner should decide. Options:

  • (a) Additive AuthExports.signIn(request, credentials) and signOut(request), which run the same verify, backoff, device and cookie steps as the native handlers and return the session headers for the adapter to pass through.
  • (b) A bounded, declarative denial-body option on the auth policy, drawn from a fixed code set like [Request]: Keep fixed JSON APIs declarative when method denials need a JSON error envelope #821's, with no arbitrary templates.
  • (c) Document both as the intended boundary: the native auth contract is the only one supported for sign-in and denials.

Nothing here may weaken CSRF, origin or cookie handling.


Generated by Claude Code

Activity

  1. added
    enhancement
    needs-decision
    ai-first
    extension
    on Sep 27, 2026
  2. changed the title [-][Request]: AuthExports has no sign-in/sign-out and auth denials cannot carry an app error envelope (fixed-contract adapters)[/-] [+][On hold]: AuthExports has no sign-in/sign-out and auth denials cannot carry an app error envelope (fixed-contract adapters)[/+] on Sep 28, 2026
  3. jimhoyd commented on Sep 29, 2026

    @jimhoyd
    CollaboratorAuthor

    Obsolete after #854 and #841. The contracts this issue describes are deleted: AuthExports, the fixed-contract adapter recipe and the admin package. Auth is now a thin Better Auth adapter that provides only a request principal and the identity capability. Store deletion and replace go through its HTTP API and StoreExports.transaction (#862), so no adapter-contract expansion is planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-firstenhancementextensionneeds-decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions