add an option to disconnect from a route that needs upstream oauth#121
Merged
add an option to disconnect from a route that needs upstream oauth#121
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds a “disconnect” option so users can purge their upstream OAuth token and reconnect with new scopes.
- Extends Zod schemas with
disconnectRequestSchema/disconnectResponseSchemaandneeds_oauthflags - Implements
disconnectFromServerlogic and UI button inServerSelector - Adds tests covering button rendering and the POST request to the disconnect endpoint
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/lib/schemas.ts | Added needs_oauth to server schemas and defined disconnect request/response schemas and types |
| src/components/ServerSelector.tsx | Imported new schemas, defined POMERIUM_DISCONNECT_ENDPOINT, added disconnectFromServer logic, modified JSX/CSS to render a disconnect button when appropriate |
| src/components/ServerSelector.test.tsx | Added tests for showing/hiding the disconnect button and verifying the POST call and event prevention behavior |
Comments suppressed due to low confidence (1)
src/components/ServerSelector.test.tsx:185
- After triggering the disconnect fetch, add an assertion to verify that
onServersChangeis called with the updated server list so the UI state is correctly updated.
expect(disconnectFetch).toHaveBeenCalledWith(
| window.location.href = connectUrl | ||
| } | ||
|
|
||
| const disconnectFromServer = async (serverId: string) => { |
There was a problem hiding this comment.
[nitpick] The disconnectFromServer function is doing multiple responsibilities (validation, fetch, parsing, state mapping). Consider extracting its logic into a custom hook or utility module to improve readability and testability.
Member
|
I opted for an unplug icon instead of the Before After |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


if a route needs an upstream oauth, sometimes the user needs to purge its upstream authentication so that it can re-acquire it again, possibly with different scopes and options.
adds a ui component that allows to do that.

Ref: https://linear.app/pomerium/issue/ENG-2545/mcp-user-should-be-able-to-purge-their-upstream-oauth2-token
Depends on: pomerium/pomerium#5707