Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Conversation

@NaderRNA
Copy link
Collaborator

@NaderRNA NaderRNA commented Oct 15, 2024

Ability to connect to datasources (airbyte) using OAuth login page

Uses passport.js to authenticate the OAuth, gets the refreshToken (which is the only thing airbyte needs to establish a connection to a source with OAuth).

Aims to keep current datasource flow as unchanged as possible.

We only have client ID and client Secrets for the following which will be the only ones supported:
(crossed out oauth providers are implemented)

  • Hubspot
  • Salesforce (forcedotcom)
  • Airtable
  • Google Ads (not sure if we have an approved clientId and secret)
  • Xero
  • Slack

@NaderRNA NaderRNA changed the base branch from master to develop October 15, 2024 22:39
@github-actions
Copy link

github-actions bot commented Oct 15, 2024

File Coverage
All files 96%
src/lib/utils/validationutils.ts 95%

Minimum allowed coverage is 80%

Generated by 🐒 cobertura-action against b4f9ea2

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

…handling of new route to get the redirect url for oauth to be completed
server.get('/register', unauthedMiddlewareChain, checkSessionWelcome, renderStaticPage(app, '/register'));
server.get(
'/login',
unauthedMiddlewareChain,

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
@NaderRNA NaderRNA linked an issue Oct 21, 2024 that may be closed by this pull request
@NaderRNA NaderRNA self-assigned this Oct 21, 2024
…ill need to patch bugs, fix issues, make dynamic
@NaderRNA
Copy link
Collaborator Author

NaderRNA commented Oct 22, 2024

Current status of the code:

  1. Successfully authenticates the user with specifically HubSpot currently.
  2. Passes the refreshToken back through the callback function (OAuth controller)
  3. Callback redirects back to datasource/add page with information required to set up datasource
  4. CreateDatasourceForm makes a POST with the sourceConfig set to the required config for the given oauth connector
  5. That then creates the TestDatasource object using the OAuth credentials
  6. Continue datasource creation as standard using the existing flow

The next few commits will likely be refactoring the implementation to do the following in order:

  1. pass the datasource name and datasource description through the flow
  2. Provide the user with better feedback indicating what's happening (adding a new loader for OAuth to say that authentication was successful and Agent Cloud is testing the datasource)
  3. Make the entire flow more compatible for other oauth providers, not just hubspot

oauthRouter.get(
'/hubspot/callback',
useSession,
useJWT,

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
oauthRouter.get(
'/salesforce/callback',
useSession,
useJWT,

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
oauthRouter.get(
'/xero/callback',
useSession,
useJWT,

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
oauthRouter.get(
'/airtable/callback',
useSession,
useJWT,

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
@NaderRNA
Copy link
Collaborator Author

NaderRNA commented Nov 5, 2024

Somewhere along the line here a bug was introduced that replaced the file upload/drop area with the connectors dropdown

@ragyabraham
Copy link
Contributor

@NaderRNA what's happening with this PR?? where are we with this??

@NaderRNA
Copy link
Collaborator Author

NaderRNA commented Nov 12, 2024

Currently the branch supports custom OAuth implementation for any OAuth provider where we have a Client ID and Client Secret for the oauth. Currently HubSpot is completley functional using OAuth but there are some issues with out Airtable, Salesforce and Xero app credentials so I'm just trying to iron those out with Andrew.
If you'd like a version that can go to prod alongside BYO VectorDBs I can modify this code so it won't break prod and will work for HubSpot.
But currently if you know the OAuth provider endpoint and required scopes you can create any custom OAuth implementation using this implementation of the code, nothing is hardcoded so introduction of new OAuth implementation is a lot easier for both account creation and datasource auth.

This reverts commit cea520e.
@NaderRNA
Copy link
Collaborator Author

NaderRNA commented Nov 21, 2024

reverting back because Airtable was creating more problems as I was implementing it. Using custom strategies on passport seems to be broken with our current versions of passport.js. To use airtable or anything not supported by passport.js, a custom implementation is required that skips passport implementation and is completely end to end handled by the webapp

@ragyabraham
Copy link
Contributor

@iandjx where are we at with this.... this would be a really good addition

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Custom Passport.js strategies for unsupported OAuth providers Better OAuth implementation for datasource/airbyte

4 participants