#7664·nango

HubSpot 提供商使用 v1 OAuth 端点: 新的 Marketplace 产品列表现在需要 2026-03,而 v1 将于 2027-02-16 停止运行

作者: mike-shvets创建于 2026年9月25日更新于 2026年9月25日

What's wrong

The hubspot provider exchanges and refreshes tokens on HubSpot's v1 OAuth endpoint, and the pre-connection-deletion hook revokes on v1:

  • packages/providers/providers.yaml: token_url: https://api.hubapi.com/oauth/v1/token
  • packages/server/lib/hooks/connection/providers/hubspot/pre-connection-deletion.ts: DELETE https://api.hubapi.com/oauth/v1/refresh-tokens/{token} This causes two problems. The replacements for both calls are POST /oauth/2026-03/token, /token/introspect and /token/revoke.
  1. Now: an app whose OAuth runs through Nango can't meet HubSpot's listing requirements. Since May 2026, new HubSpot Marketplace listings, certifications, and recertifications must use the 2026-03 OAuth endpoints, effective immediately (changelog). HubSpot also shows the app's owner an "API support ending" banner.
  2. 2027-02-16: every HubSpot connection stops refreshing. HubSpot retires the v1 endpoints that day (changelog).

Suggested change

Two files, +21 −5, against master at 490a459. It passes npm run ts-build, npm run test:providers, oxlint (no new warnings) and Prettier.

  • Token exchange and refresh need only the URL change. Nango already sends the client credentials in a form-encoded body by default, which is what the new endpoint expects.
  • Revoke needs the hook rewritten. The new endpoint is a POST with client_id, client_secret and token in a form body. HubSpot's own error message names those three as required. The hook takes the client credentials from the integration, or from the connection's config_override when one is set, the same pair the refresh uses.
diff
--- a/packages/providers/providers.yaml
+++ b/packages/providers/providers.yaml
@@ -11854,7 +11854,7 @@ hubspot:
         - popular
     auth_mode: OAUTH2
     authorization_url: https://app.hubspot.com/oauth/authorize
-    token_url: https://api.hubapi.com/oauth/v1/token
+    token_url: https://api.hubapi.com/oauth/2026-03/token
     connection_configuration:
         - portalId
     post_connection_script: hubspotPostConnection
--- a/packages/server/lib/hooks/connection/providers/hubspot/pre-connection-deletion.ts
+++ b/packages/server/lib/hooks/connection/providers/hubspot/pre-connection-deletion.ts
@@ -17,14 +17,30 @@ export default async function execute(nango: InternalNango) {
         if (!credentials.refresh_token) {
             return;
         }
+
+        // The revoke endpoint authenticates the app with its client credentials in the body,
+        // so use the same pair the token refresh uses, including a per-connection override.
+        const integration = await nango.getIntegration();
+        const clientId = credentials.config_override?.client_id || integration?.oauth_client_id;
+        const clientSecret =
…