feat(web): select organization during plugin auth - #1590
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | 8f063bd | Aug 24 2026, 04:15 PM |
How to use the Graphite Merge QueueAdd the label Main to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 8f063bd | Commit Preview URL Branch Preview URL |
Aug 24 2026, 04:17 PM |
|
Claude finished @ishaanxgupta's task in 1m 50s —— View job Review Complete
Overview: Adds organization selection to the plugin authorization flow, allowing users to choose which organization to connect plugins to before approving access. Issues found: None — this looks good to ship. Analysis:
Score: 10/10 Clean, defensive code with proper security boundaries and edge case handling. No inline comments needed. |
There was a problem hiding this comment.
Overview: Adds organization selection to the plugin authorization flow, allowing users to choose which organization to connect plugins to before approving access.
Issues found: None — this looks good to ship.
Analysis:
-
Security: Callback URLs are properly restricted to localhost via
isValidLocalhostCallback(lines 25-36). The key prefix validation (lines 364-371) provides defense-in-depth to ensure returned keys belong to the expected organization. -
State management: The status flow (
loading→selection/approval→creating→success) is well-defined. Edge cases are handled correctly:- Selected organization removal is detected and gracefully recovers to selection (lines 301-312)
- The
selectedOrgderivation fromorganizations(lines 239-241) ensures stale org IDs returnnull, which is caught inhandleConnect - Single-org users skip selection and go directly to approval (lines 283-289)
-
Error handling:
Promise.allSettledcorrectly separates successes from failures when issuing keys for multiple clients. Errors return the user to the appropriate state (selectionorapproval) rather than a dead-end error screen. -
Request validation: Moved to a computed
requestErroruseMemo (lines 230-238) which is cleaner than the previous effect-based approach and shows the error immediately.
Score: 10/10
Clean, defensive code with proper security boundaries and edge case handling.

Summary
Add organization selection to the production plugin authorization flow, following the existing MCP consent pattern so users choose the destination organization before approving access.
Changes
/auth/connectperforms onboarding or organization-selection transitions.Testing
./node_modules/.bin/biome check apps/web/app/auth/connect/page.tsx packages/lib/auth-context.tsx— passed.git diff --check— passed.Attached Images and Videos
🎥 View recording: plugin-auth-invalid-request-local.webm
🎥 View recording: plugin-auth-unauth-boundaries.webm
[plugin-auth-supermemory-biome.log]
[plugin-auth-supermemory-web-types.log]
Session Details
(aside)to your comment to have me ignore it.