#7664·nango

HubSpot provider uses the v1 OAuth endpoints: new Marketplace listings need 2026-03 now, and v1 stops working 2027-02-16

Author: mike-shvetsCreated Sep 25, 2026Updated Sep 25, 2026

What

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}

That 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 = credentials.config_override?.client_secret || integration?.oauth_client_secret;
+        if (!clientId || !clientSecret) {
+            return;
+        }
+
         const response = await nango.proxy({
-            method: 'DELETE',
-            // https://developers.hubspot.com/docs/guides/api/app-management/oauth-tokens#delete-a-refresh-token
-            endpoint: `https://api.hubapi.com/oauth/v1/refresh-tokens/${credentials.refresh_token}`,
+            method: 'POST',
+            // https://developers.hubspot.com/changelog/v1-oauth-api-deprecation
+            endpoint: '/oauth/2026-03/token/revoke',
             headers: {
-                'Content-Type': 'application/json',
+                'Content-Type': 'application/x-www-form-urlencoded',
                 Authorization: '' // override Authorization header
             },
+            data: new URLSearchParams({
+                client_id: clientId,
+                client_secret: clientSecret,
+                token: credentials.refresh_token,
+                token_type_hint: 'refresh_token'
+            }).toString(),
             providerConfigKey: connection.provider_config_key
         });

Tested against HubSpot

We tested this on 2026-09-25 on a HubSpot developer test portal, with a marketplace-distribution app on developer platform 2026.03. Both runs passed:

Step Code exchanged on v1 (existing connections) Code exchanged on 2026-03 (new connections)
Code exchange 200 200
Refresh on /oauth/2026-03/token 200, refresh token unchanged 200, refresh token unchanged
API call with the refreshed access token 200 200
Introspect on 2026-03 active: true active: true
Revoke on 2026-03 (form body) 200 200
Refresh after revoke, 2026-03 and v1 400 BAD_REFRESH_TOKEN on both 400 BAD_REFRESH_TOKEN on both
Introspect after revoke active: false active: false

What this shows for the change:

  • Existing connections keep refreshing after the switch. A refresh token issued on v1 refreshes on 2026-03.
  • The token response is unchanged. v1 and 2026-03 return the same fields: access_token, expires_in, hub_id, refresh_token, scopes, token_type, token_use. expires_in is 1800.
  • The error body is identical across /oauth/v1/token, /oauth/v3/token and /oauth/2026-03/token: status, message, error, error_description.

HubSpot supports each date-versioned API for 18 months, so 2026-03 will need a bump around September 2027. The numbered /v3/ paths go unsupported at the same time.