Skip to content

CL-6389: mount createOAuthConnectRoutes in apps/hub - #136

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-6389-oauth-mount
Aug 20, 2026
Merged

TheGreatAxios merged 2 commits into
mainfrom
cl-6389-oauth-mount

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

  • createOAuthConnectRoutes (packages/connections' oauth-pkce/oauth-code factory) was exported but only reachable through packages/onboarding's first-login mount, and that mount never threaded GITHUB_APP_CLIENT_ID/SECRET into its oauthEnv -- so the GitHub App one-click connect path added in CL-6386: GitHub connect discoverable in Plugins, select on new-workbench #132 always reported not_configured even when configured.
  • Threads githubAppClientId/githubAppClientSecret through onboarding's existing mount.
  • Adds a second, tenant-scoped mount directly in apps/hub at .../connections/oauth, beside the existing createConnectionRoutes settings surface (mirrors MCP OAuth connect: fix missing state param (CL-6371) #115's mcp-servers/oauth pattern -- state-param CSRF, real state(), exact-match callback validation, all inside the factory itself).
  • Adds createTenantConnectCredential (packages/connections) as the connectCredential wiring that new mount needs -- reads the tenant/principal the platform's tenant middleware already resolved and persists the same way createConnectionRoutes' own /complete handler does.

Test plan

  • packages/connections typecheck + tests (full authorize->callback->credential-stored round trip, tampered-state rejection, provider-health clear)
  • packages/onboarding typecheck + tests
  • apps/hub typecheck + tests
  • Scratch-stack sanity: booted the hub against a scratch Postgres DB; /api/onboarding/oauth/{openrouter,huggingface,github}/start all resolve 302 (unknown connector 404s); new .../connections/oauth/openrouter/start mount resolves (401 unauthenticated, matching every other tenant-scoped route's behavior -- not 404); confirmed no path overlap with mcp-servers/oauth

Covers createTenantConnectCredential mounted through the real
createOAuthConnectRoutes factory: a full authorize -> callback ->
credential-stored round trip, a tampered-state callback that must
never persist anything, and provider-health clearing on connect.
createOAuthConnectRoutes (packages/connections' oauth-pkce/oauth-code
factory) was exported but only reachable through packages/onboarding's
first-login mount, and even there its oauthEnv never carried
GITHUB_APP_CLIENT_ID/SECRET — so the GitHub App one-click connect path
added in #132 always reported not_configured. Threads those two
through onboarding's own mount, and adds a second, tenant-scoped mount
directly in apps/hub at .../connections/oauth, beside the existing
createConnectionRoutes settings surface, so a caller that already
knows its tenant (not just onboarding's first-login flow) can drive
the same OAuth connect mechanics.

createTenantConnectCredential (packages/connections) is the
connectCredential wiring that new mount needs: it reads the tenant/
principal the platform's own tenant middleware already resolved
(c.get("tenant")/c.get("principal")) and persists exactly the way
createConnectionRoutes' own /complete handler does -- ensureProvider +
ensureCredential, then seedCatalog for an inference connector.
connectCredential's own args gained a c: Context field so a
tenant-scoped caller can read it directly, matching the shape
afterConnected already had; onboarding's existing implementation is
unaffected since it never reads it.
@TheGreatAxios
TheGreatAxios merged commit a3f1774 into main Aug 20, 2026
0 of 2 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-6389-oauth-mount branch August 25, 2026 15:29
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