I am trying to create a HubSpot connection trough ...
# ask-ai
g
I am trying to create a HubSpot connection trough the api trough dagster, but getting an error on the access token, can you see why? Manually the token does work and the source is created. Used json: --- CONFIG START --- { "ops": { "create_airbyte_source_api": { "config": { "configuration": { "access_token": "pat-eu1-a96c72da-462b-4544-8593-35365c6532fe" }, "datasource": "hubspot", "workspace_id": "460ffd38-71d3-47c9-aa35-caabb0c0b1fb", "company_shorthand": "DNS" } } } } --- CONFIG END ---
k
Based on the information in the knowledge sources, there are a few important points regarding HubSpot authentication with Airbyte: 1. OAuth Flow Required: Airbyte's HubSpot connector expects authentication via OAuth, not just a personal access token (PAT). The standard setup process involves using the Airbyte UI to trigger an OAuth flow, where you sign in to HubSpot and authorize the app. This process provides Airbyte with the necessary access and refresh tokens, not just a static access token or PAT. The documentation and user reports indicate that manually entering a token (like a PAT) is not the supported method for HubSpot connections in Airbyte, especially in recent versions. The connector expects to manage the OAuth flow and token refresh itself, not just use a static token you provide in the config [HubSpot Destination Setup](https://docs.airbyte.com/integrations/enterprise-connectors/destination-hubspot#hubspot-destination). 2. Manual Token Entry Limitations: There is a known issue and user feedback that, as of Airbyte 1.4 and later, you can no longer manually enter an access token or refresh token for OAuth2 sources like HubSpot. The connector requires the full OAuth flow to be completed through Airbyte, which is why your manual approach with a PAT works in the UI (where the OAuth flow is triggered) but fails when you try to create the source programmatically with just an access token [Bring-your-own-credentials Issue](https://github.com/airbytehq/airbyte/issues/52084). 3. Error Consistency: Other users have reported similar issues when trying to programmatically create or update a HubSpot source with tokens obtained outside of Airbyte's OAuth flow. Even if the token is valid and works with direct API calls, Airbyte may reject it with errors like “refresh token was not issued to this client” or generic access token errors. This is likely because Airbyte expects to control the OAuth client and token lifecycle, and may perform additional checks or require specific token metadata [Programmatic Config Flow Fails](https://github.com/airbytehq/airbyte/issues/57001). Summary: You cannot create a HubSpot source in Airbyte by simply providing a personal access token or even a refresh token in the config. Airbyte expects to handle the OAuth flow itself, and the UI process is required to generate the correct tokens and configuration. This is why your manual setup works, but the API approach with just an access token does not. Recommendation: To automate source creation, you would need to replicate the full OAuth flow as Airbyte expects, which is not currently supported via a simple API call with a PAT or static token. If you need to automate this, you may need to use the Airbyte UI for the initial OAuth handshake, or explore if Airbyte's API supports a way to inject the full OAuth credentials (including refresh token, client ID, and client secret) as part of the source configuration, but this is not documented as supported for HubSpot at this time. If you need further automation, consider opening a feature request or following related issues for updates on supporting "bring your own credentials" for OAuth2 sources like HubSpot. References: - [HubSpot Destination Setup](https://docs.airbyte.com/integrations/enterprise-connectors/destination-hubspot#hubspot-destination) - [Bring-your-own-credentials Issue](https://github.com/airbytehq/airbyte/issues/52084) - [Programmatic Config Flow Fails](https://github.com/airbytehq/airbyte/issues/57001)