Skip to content

feat(system-config): proxy the public system config from both adapters - #143

Merged
Bccorb merged 1 commit into
mainfrom
feat/public-system-config-route
Jul 31, 2026
Merged

feat(system-config): proxy the public system config from both adapters#143
Bccorb merged 1 commit into
mainfrom
feat/public-system-config-route

Conversation

@Bccorb

@Bccorb Bccorb commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Third of four PRs adding the ability to skip passkey registration.

Draft: blocked on the auth API route (fells-code/seamless-auth-api#136), which is itself blocked on fells-code/seamless-auth-types#23. Nothing here breaks without them, the proxied route just 404s upstream until the API ships it.

Why this repo is in the chain at all

I did not expect it to be. Both adapters serve routes from an explicit allowlist, not a catch-all proxy, so a new upstream route is simply unreachable through them until it is added here. Without this PR the React SDK's call would 404 at the adapter and never reach the auth API.

What

getPublicSystemConfigHandler in core, wired into the Express adapter's createServer and the Fastify adapter's authRoutes.

It forwards no identity: no authorization header, no service token. That matches how upstream serves the route and how the existing public GET /oauth/providers already behaves here. A signed-out browser is the expected caller, so attaching a session would only put a stale cookie in the path of the one call that client has to make.

No change needed in ensureCookies: its COOKIE_REQUIREMENTS map is prefix-matched, and /system-config/public matches none of the existing /system-config/* entries, so it correctly falls through as ungated. Worth knowing if anyone later adds a bare /system-config entry, which would silently capture this route.

Tests

Three cases added to the parity suite:

  • the route returns the same body through both adapters
  • an upstream failure passes through identically
  • neither adapter sends authorization or x-seamless-service-token, asserted with a valid access cookie present, so a future refactor cannot quietly start attaching one

That last one deliberately compares header names rather than the full header objects: Express and Fastify report the test loopback socket differently (::ffff:127.0.0.1 against 127.0.0.1), which is the harness rather than anything either adapter decides.

Verification

core 214 passing, express 150 passing, fastify 43 passing. All three packages build.

Next

seamless-auth-react: consume this, gate a skip control on the passkey registration screen, and drop the hardcoded method fallback.

Both adapters serve routes from an explicit list, so the auth API's new
GET /system-config/public is unreachable through them until it is added here.

The route returns the configured loginMethods to a signed-out caller. That is
what lets the bundled sign-in screens offer the methods an instance actually has
enabled rather than a hardcoded guess, and lets them tell whether declining a
passkey during registration would leave a user with no way back in.

getPublicSystemConfigHandler forwards no identity: no authorization header and
no service token, matching how upstream serves the route and how the existing
public GET /oauth/providers already behaves. A signed-out browser is the
expected caller, so attaching a session would only put a stale cookie in the
path of the one call that client has to make.

The parity suite covers the new route in both adapters, including an upstream
failure passing through, and asserts neither adapter sends an identity even when
a valid access cookie is present.

Verified with the core, express, and fastify suites: 214, 150, and 43 passing.
@Bccorb
Bccorb marked this pull request as ready for review July 31, 2026 02:54
@Bccorb
Bccorb merged commit 56438fc into main Jul 31, 2026
2 checks passed
@Bccorb
Bccorb deleted the feat/public-system-config-route branch July 31, 2026 03:03
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