Bug: MCP OAuth2 API credential does not support HubSpot MCP OAuth v3 token exchange
Hi everyone,
I’m trying to connect the HubSpot Remote MCP Server using the new MCP OAuth2 API credential in n8n.
I’ve narrowed the issue down by comparing the requests generated by MCP Inspector (which works) and n8n (which fails).
Environment
- n8n version:
- Credential type: MCP OAuth2 API
- HubSpot Remote MCP Server
OAuth Configuration
Authorization URL
https://mcp.hubspot.com/oauth/authorize
Token URL
https://mcp.hubspot.com/oauth/v3/token
Grant Type
PKCE
Authentication
Body
Scope
oauth
Expected behavior
The OAuth flow should complete successfully and store the access token.
Actual behavior
The browser successfully authenticates with HubSpot and redirects back to n8n with an authorization code.
The token exchange fails with:
{
"status": "BAD_CLIENT_SECRET",
"message": "missing or invalid client secret",
"error": "invalid_client"
}
Earlier in debugging I also saw:
BAD_CLIENT_ID(fixed by correcting the OAuth endpoints)Unsupported content type(fixed by using/oauth/v3/token)
The remaining failure occurs during the token exchange.
Investigation
To compare the requests, I temporarily changed the Token URL to a webhook endpoint so I could inspect the request that n8n generates.
n8n sends
Headers
Content-Type: application/x-www-form-urlencoded
Authorization: Basic <base64(client_id:client_secret)>
Body
grant_type=authorization_code
code=...
redirect_uri=...
code_verifier=...
Even when Authentication = Body is selected, n8n still sends the Authorization Basic header and does not include client_id or client_secret in the body.
MCP Inspector (working)
Headers
Content-Type: application/x-www-form-urlencoded
Body
grant_type=authorization_code
code=...
code_verifier=...
redirect_uri=...
resource=https://mcp.hubspot.com/
client_id=...
client_secret=...
This request succeeds.
Differences
Compared to the working MCP Inspector request, n8n appears to:
-
Send
Authorization: Basiceven when Authentication = Body is selected. -
Omit
client_idfrom the form body. -
Omit
client_secretfrom the form body. -
Omit the OAuth
resourceparameter:resource=https://mcp.hubspot.com/
Questions
- Is Authentication = Body currently implemented for the MCP OAuth2 API credential?
- Is there currently any way to include the OAuth
resourceparameter in the token request? - Is HubSpot Remote MCP currently supported by the MCP OAuth2 credential?
Happy to provide additional logs or test a fix if needed.
n8n Instance Details:
Version: 2.10.2
Licence: Sustainable Use License + n8n Enterprise License
Self-Hosted
Thanks!