Configure OAuth for HubSpot ingestion

Learn how to configure HubSpot for ingestion from HubSpot Marketing Hub into Azure Databricks. The managed HubSpot connector in Lakeflow Connect uses OAuth 2.0 user-to-machine (U2M) authentication. Use the authentication details that you retrieve from the steps on this page to create a Unity Catalog connection in Azure Databricks.

Note

HubSpot retired the legacy public app creation UI. Create your app using HubSpot's project-based platform and the HubSpot CLI, as described on this page. See the HubSpot changelog for details.

Install and authenticate the HubSpot CLI

  1. Install Node.js version 20 or above.

  2. Install the HubSpot CLI:

    npm install -g @hubspot/cli
    
  3. Authenticate the CLI with your HubSpot account:

    hs account auth
    

    Follow the prompts to generate a personal access key and save it to your local CLI configuration.

Create an app and retrieve authentication details

  1. Create an app on HubSpot's project-based platform:

    hs project create --project-base app --auth oauth --distribution private
    
  2. In the generated app-hsmeta.json file, set auth.redirectUrls to your workspace's redirect URL (format: https://<your_workspace_domain>/login/oauth/lakehousefederation.html). For example: https://e2.our-staging-workspace.cloud.databricks.com/login/oauth/lakehousefederation.html

  3. In the same file, set auth.requiredScopes to only the following scopes. Omitting any of these or adding additional scopes will cause failures later in the setup process.

    • oauth
    • communication_preferences.read
    • content
    • crm.objects.marketing_events.read
    • crm.objects.marketing_events.write
    • forms
    • forms-uploaded-files
    • marketing.campaigns.read
  4. Deploy the app to your HubSpot account:

    hs project upload
    
  5. Retrieve the app's authentication details:

    hs project open
    

    Under Project Components, select your app, then click the Auth tab. Note the Client ID and the Client secret. Use these to create a Unity Catalog connection in Azure Databricks.

  6. Install the app in your HubSpot account:

    1. Go to Development > Projects.
    2. Select your project, then select your app.
    3. On the Distribution tab, click Install now and authorize the app.

Migrate a legacy app

If you already have a legacy public app configured for HubSpot ingestion, migrate it to the project-based platform instead of creating a new app. Migration preserves your app's existing Client ID, Client secret, and installs, so you don't need to update your Unity Catalog connection.

  1. Update the HubSpot CLI to version 7.6.0 or later:

    npm install -g @hubspot/cli@latest
    
  2. Run the migration command and follow the prompts to select your app and confirm the components to migrate:

    hs app migrate
    

For details, see HubSpot's migration guide.

Next steps

Use Catalog Explorer to create a connection so that any user with USE CONNECTION or ALL PRIVILEGES can create pipelines. See Create a HubSpot connection.