Skip to content

fix: add return url and connection id to oauth url state#1160

Open
lucaseduoli wants to merge 3 commits intomainfrom
fix/oauth_return_url
Open

fix: add return url and connection id to oauth url state#1160
lucaseduoli wants to merge 3 commits intomainfrom
fix/oauth_return_url

Conversation

@lucaseduoli
Copy link
Collaborator

This pull request enhances the OAuth authentication flow by supporting a configurable public return URL and improving how state is handled and parsed during the OAuth process. These changes ensure that after authentication, users are redirected to the appropriate location, and the connection ID is consistently tracked through the flow.

OAuth Flow Improvements:

  • Added an optional public_return_url to the OAuth response and included it in the state parameter during the OAuth handshake, allowing dynamic redirect destinations after authentication. (frontend/app/api/mutations/useConnectConnectorMutation.ts [1] [2] [3]; frontend/contexts/auth-context.tsx [4] [5]; src/config/settings.py [6]; src/services/auth_service.py [7]
  • Updated the backend to include public_return_url in the OAuth config response, sourcing it from the new PUBLIC_RETURN_URL environment variable. (src/services/auth_service.py [1] [2]

State Parameter Handling:

  • Modified the OAuth state parameter to include both the connection_id and the encoded return URL, and ensured it is properly encoded and decoded throughout the flow. (frontend/app/api/mutations/useConnectConnectorMutation.ts [1] [2]; frontend/contexts/auth-context.tsx [3] [4]; frontend/app/auth/callback/page.tsx [5]
  • Improved the parsing of the state parameter on the callback page to extract both the connection_id and the return URL, using these values to finalize authentication and redirect appropriately. (frontend/app/auth/callback/page.tsx [1] [2]

Backend OAuth Connector Updates:

  • Updated the Google Drive OAuth connector to accept an optional state parameter and include it in the authorization URL if provided. (src/connectors/google_drive/oauth.py [1] [2]

Code Cleanup:

  • Minor logging and import order adjustments for clarity and consistency. (src/services/auth_service.py [1] [2] [3]

@github-actions github-actions bot added frontend 🟨 Issues related to the UI/UX backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) bug 🔴 Something isn't working. labels Mar 16, 2026
@lucaseduoli lucaseduoli self-assigned this Mar 16, 2026
@github-actions github-actions bot added bug 🔴 Something isn't working. and removed bug 🔴 Something isn't working. labels Mar 17, 2026
@github-actions github-actions bot added bug 🔴 Something isn't working. and removed bug 🔴 Something isn't working. labels Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) bug 🔴 Something isn't working. frontend 🟨 Issues related to the UI/UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant