Repository navigation
[codex] show plugin OAuth providers on login - #32
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughFrontend now preserves the full auth provider list returned by /auth/providers during AuthProvider initialization. Backend AuthHandler gains an oauthRoutesAvailable flag (set by the router) and conditionally omits oauth-mode providers from the providers response when OAuth routes are unavailable. Tests added for both frontend and backend behavior. ChangesProvider List Preservation in Auth Context
Backend: OAuth gating and tests
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Fixes the issue for #30 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bc593471a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| setSetupRequired(status.needs_setup); | ||
| setProviders((availableProviders ?? []).filter((entry) => entry.mode === "credentials")); | ||
| setProviders(availableProviders ?? []); |
There was a problem hiding this comment.
Hide OAuth providers when OAuth routes are unavailable
When a plugin declares OAuth-only auth on a server without PublicURL configured, this now exposes that provider to the login page, but the backend only registers /auth/oauth/{install_id}/init when deps.PublicURL != "" (and DB/JWT are available) in internal/api/router.go:1136-1140 and otherwise skips the route at internal/api/router.go:1182-1187, while /auth/providers remains registered unconditionally. In that configuration the newly visible button posts to a missing endpoint and users get a 404 instead of a usable sign-in path; either the provider list needs to reflect OAuth route availability or the UI should not surface these OAuth providers unless the route can actually handle them.
Useful? React with 👍 / 👎.
* fix(auth): show oauth login providers * fix(auth): hide oauth providers when routes are unavailable
* fix(auth): show oauth login providers * fix(auth): hide oauth providers when routes are unavailable
* fix(auth): show oauth login providers * fix(auth): hide oauth providers when routes are unavailable
* fix(auth): show oauth login providers * fix(auth): hide oauth providers when routes are unavailable
Summary
Fixes #30 by preserving usable providers returned from
/api/v1/auth/providersin the web auth context.Login.tsxalready separates credential and OAuth providers, but the auth hook was filtering the list down to credential providers before the login page could render OAuth sign-in buttons.This also keeps the backend provider list aligned with route availability: OAuth providers are only advertised when the router actually mounted the
/api/v1/auth/oauth/{installation_id}/initflow. Servers withoutSILO_PUBLIC_URLconfigured will not show unusable OAuth buttons.Impact
Custom auth plugins that declare OAuth-only login now appear on the login screen when OAuth is configured and submit through
/api/v1/auth/oauth/{installation_id}/initas intended. If OAuth routes are unavailable, those providers stay hidden instead of leading users to a 404.@thezak48 could you test this PR with your custom OAuth plugin and confirm the sign-in option now appears and starts the OAuth flow correctly on a server with
SILO_PUBLIC_URLconfigured?Validation
go test ./internal/api/handlersgo test ./internal/apipnpm --dir web exec vitest run src/hooks/AuthProvider.test.tsx src/hooks/useAuth.test.tspnpm --dir web exec prettier --check src/hooks/AuthProvider.test.tsx src/hooks/useAuth.tsxpnpm --dir web exec tsc -b --pretty falsepnpm --dir web exec eslint src/hooks/useAuth.tsx src/hooks/AuthProvider.test.tsxSummary by CodeRabbit
Bug Fixes
Tests