Skip to content

Update OAuth login workflow#52

Merged
Dumbris merged 11 commits into
mainfrom
bugfix/browser-open
Sep 3, 2025
Merged

Update OAuth login workflow#52
Dumbris merged 11 commits into
mainfrom
bugfix/browser-open

Conversation

@Dumbris

@Dumbris Dumbris commented Sep 3, 2025

Copy link
Copy Markdown
Member
  • Add containsString helper function to check if a string contains a substring.
  • Enhance OAuth error detection in isOAuthError method to identify specific OAuth-related errors.
  • Improve isAuthError method to exclude OAuth errors from non-OAuth authentication checks.
  • Introduce rate limiting for browser opening during OAuth authorization to prevent excessive attempts.

This update improves the robustness of the OAuth authentication flow and enhances error handling during connection initialization.

- Add `containsString` helper function to check if a string contains a substring.
- Enhance OAuth error detection in `isOAuthError` method to identify specific OAuth-related errors.
- Improve `isAuthError` method to exclude OAuth errors from non-OAuth authentication checks.
- Introduce rate limiting for browser opening during OAuth authorization to prevent excessive attempts.

This update improves the robustness of the OAuth authentication flow and enhances error handling during connection initialization.
- Introduced `auth` command with subcommands for manual OAuth login and status checks.
- Implemented `runAuthLogin` and `runAuthStatus` functions for handling authentication flows.
- Enhanced CLI client with manual OAuth triggering and status retrieval methods.
- Updated main command structure to include the new authentication commands.

This update improves user experience by providing direct command-line access to OAuth authentication management.
- Introduced TokenStoreManager for shared token persistence across client instances.
- Updated server creation to track the actual config path used.
- Enhanced OAuth client creation with detailed logging and context-based timeouts.
- Implemented OAuth login functionality in the tray application, allowing users to authenticate directly from the menu.
- Improved error handling and logging for OAuth processes, ensuring better observability and user guidance.

This update streamlines the OAuth authentication flow and enhances user experience by providing direct access to OAuth login from the tray menu.
- Updated `runAuthLogin` and `runAuthStatus` functions to use underscore parameters for clarity.
- Introduced `oauthRequired` constant for better readability in OAuth status checks.
- Enhanced connection handling by replacing string literals with defined constants for transport types.

This update improves code clarity and maintainability by adhering to best practices in constant usage and function signatures.
- Updated the ListTools method to check for server info availability before verifying tool support.
- Added debug logging for better observability when server info is not available.

This change improves error handling and provides clearer diagnostics when the client is not connected to a server.
- Simplified manual OAuth flow detection by using a context key instead of inspecting the call stack.
- Enhanced logging to include server name and time since the last browser opening for better diagnostics.

This update improves the clarity and observability of the OAuth authorization process.
…tation

- Introduced a detailed debugging guide in CLAUDE.md, covering log locations, essential commands, and common issues for OAuth and tool discovery.
- Implemented PersistentTokenStore for OAuth token management, allowing tokens to be stored and retrieved from a BoltDB database.
- Enhanced existing authentication command functions to ensure proper resource management with deferred closure of clients.
- Updated various components to utilize the new persistent storage for OAuth tokens, improving reliability and cross-process notifications.

This update enhances the debugging capabilities and token management for OAuth, providing better observability and persistence across client instances.
- Added persistent storage support for OAuth tokens across various client components.
- Improved logging during HTTP client and transport configuration creation for better observability.
- Updated client constructors to include storage parameters, ensuring consistent token management.
- Implemented connection retry logic after OAuth completion, enhancing reliability in cross-process scenarios.

This update strengthens the OAuth flow and improves debugging capabilities across client instances.
- Updated `runAuthStatus` to close the client connection per iteration, avoiding defers in loops for better resource management.
- Renamed `OAuthCompletionEvent` to `CompletionEvent` for clarity and consistency across the codebase.
- Enhanced the `TokenStoreManager` and related methods to ensure proper handling of OAuth completion events.
- Improved logging and error handling in various components to enhance observability during OAuth processes.

This update streamlines the OAuth flow and optimizes resource management, ensuring better performance and reliability.
- Updated `connectStdio` method to accept a context parameter for better context management.
- Implemented a persistent background context for stdio transport to ensure the child process remains active.
- Added MCP `initialize()` handshake for stdio transports to populate `c.serverInfo`, enabling tool discovery.

This update enhances the reliability of stdio connections and improves the initialization process for tool discovery.
- Added preflight checks in `StartManualOAuth` to determine if OAuth is required based on server configuration, improving user feedback.
- Implemented a no-auth initialization attempt to confirm OAuth necessity before triggering the flow.
- Enhanced error handling in `ForceOAuthFlow` to fast-fail when OAuth is not applicable, ensuring clearer diagnostics.

This update improves the efficiency of the OAuth process and enhances user experience by providing informative error messages.
@Dumbris
Dumbris merged commit 13034eb into main Sep 3, 2025
33 checks passed
@Dumbris
Dumbris deleted the bugfix/browser-open branch September 3, 2025 18:52
rannow pushed a commit to rannow/mcpproxy-go that referenced this pull request Sep 23, 2025
* Implement OAuth error handling and string containment checks

- Add `containsString` helper function to check if a string contains a substring.
- Enhance OAuth error detection in `isOAuthError` method to identify specific OAuth-related errors.
- Improve `isAuthError` method to exclude OAuth errors from non-OAuth authentication checks.
- Introduce rate limiting for browser opening during OAuth authorization to prevent excessive attempts.

This update improves the robustness of the OAuth authentication flow and enhances error handling during connection initialization.

* Add OAuth authentication commands and client integration

- Introduced `auth` command with subcommands for manual OAuth login and status checks.
- Implemented `runAuthLogin` and `runAuthStatus` functions for handling authentication flows.
- Enhanced CLI client with manual OAuth triggering and status retrieval methods.
- Updated main command structure to include the new authentication commands.

This update improves user experience by providing direct command-line access to OAuth authentication management.

* Enhance OAuth integration and server management

- Introduced TokenStoreManager for shared token persistence across client instances.
- Updated server creation to track the actual config path used.
- Enhanced OAuth client creation with detailed logging and context-based timeouts.
- Implemented OAuth login functionality in the tray application, allowing users to authenticate directly from the menu.
- Improved error handling and logging for OAuth processes, ensuring better observability and user guidance.

This update streamlines the OAuth authentication flow and enhances user experience by providing direct access to OAuth login from the tray menu.

* Refactor authentication command functions and improve constant usage

- Updated `runAuthLogin` and `runAuthStatus` functions to use underscore parameters for clarity.
- Introduced `oauthRequired` constant for better readability in OAuth status checks.
- Enhanced connection handling by replacing string literals with defined constants for transport types.

This update improves code clarity and maintainability by adhering to best practices in constant usage and function signatures.

* Enhance server info validation in ListTools method

- Updated the ListTools method to check for server info availability before verifying tool support.
- Added debug logging for better observability when server info is not available.

This change improves error handling and provides clearer diagnostics when the client is not connected to a server.

* Refactor OAuth flow detection and logging improvements

- Simplified manual OAuth flow detection by using a context key instead of inspecting the call stack.
- Enhanced logging to include server name and time since the last browser opening for better diagnostics.

This update improves the clarity and observability of the OAuth authorization process.

* Add comprehensive debugging guide and persistent token store implementation

- Introduced a detailed debugging guide in CLAUDE.md, covering log locations, essential commands, and common issues for OAuth and tool discovery.
- Implemented PersistentTokenStore for OAuth token management, allowing tokens to be stored and retrieved from a BoltDB database.
- Enhanced existing authentication command functions to ensure proper resource management with deferred closure of clients.
- Updated various components to utilize the new persistent storage for OAuth tokens, improving reliability and cross-process notifications.

This update enhances the debugging capabilities and token management for OAuth, providing better observability and persistence across client instances.

* Enhance OAuth integration and logging for client management

- Added persistent storage support for OAuth tokens across various client components.
- Improved logging during HTTP client and transport configuration creation for better observability.
- Updated client constructors to include storage parameters, ensuring consistent token management.
- Implemented connection retry logic after OAuth completion, enhancing reliability in cross-process scenarios.

This update strengthens the OAuth flow and improves debugging capabilities across client instances.

* Refactor OAuth handling and improve resource management

- Updated `runAuthStatus` to close the client connection per iteration, avoiding defers in loops for better resource management.
- Renamed `OAuthCompletionEvent` to `CompletionEvent` for clarity and consistency across the codebase.
- Enhanced the `TokenStoreManager` and related methods to ensure proper handling of OAuth completion events.
- Improved logging and error handling in various components to enhance observability during OAuth processes.

This update streamlines the OAuth flow and optimizes resource management, ensuring better performance and reliability.

* Refactor stdio transport connection handling

- Updated `connectStdio` method to accept a context parameter for better context management.
- Implemented a persistent background context for stdio transport to ensure the child process remains active.
- Added MCP `initialize()` handshake for stdio transports to populate `c.serverInfo`, enabling tool discovery.

This update enhances the reliability of stdio connections and improves the initialization process for tool discovery.

* Enhance OAuth flow handling and preflight checks

- Added preflight checks in `StartManualOAuth` to determine if OAuth is required based on server configuration, improving user feedback.
- Implemented a no-auth initialization attempt to confirm OAuth necessity before triggering the flow.
- Enhanced error handling in `ForceOAuthFlow` to fast-fail when OAuth is not applicable, ensuring clearer diagnostics.

This update improves the efficiency of the OAuth process and enhances user experience by providing informative error messages.
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