Skip to content

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

Merged
edwinjosechittilappilly merged 3 commits into
mainfrom
fix/oauth_return_url
Mar 27, 2026
Merged

fix: add return url and connection id to oauth url state#1160
edwinjosechittilappilly merged 3 commits into
mainfrom
fix/oauth_return_url

Conversation

@lucaseduoli

Copy link
Copy Markdown
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 19, 2026
@github-actions github-actions Bot added bug 🔴 Something isn't working. and removed bug 🔴 Something isn't working. labels Mar 26, 2026
@edwinjosechittilappilly edwinjosechittilappilly merged commit 7cbe69a into main Mar 27, 2026
10 checks passed
@github-actions github-actions Bot deleted the fix/oauth_return_url branch March 27, 2026 14:37
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.

3 participants