Skip to content

OAuth2 State Parameter Not Generated - "Insufficient parameters for OAuth2 callback" Error #17598

Description

@classTheTester

Describe the problem/error/question
n8n OAuth2 implementation is not generating the required 'state' parameter when initiating OAuth2 flows, causing all OAuth2 connections to fail. This affects HubSpot and potentially all other OAuth2-based integrations.
What is the error message (if any)?
Error: Insufficient parameters for OAuth2 callback.

▼ More details
Received following query parameters: {"code":"na3-9cb2-2276-40ec-aa4b-6313eb4513da"}

Failed to connect. The window can be closed now.
Please share your workflow/screenshots/recording
This occurs when attempting to create any OAuth2 credential (not workflow-specific). Steps to reproduce:

Go to Credentials → Add Credential → HubSpot OAuth2
Enter Client ID and Client Secret
Click "Connect"
Authorize in HubSpot
Error appears on callback

When manually testing the OAuth2 flow by adding &state=test123 to the authorization URL, HubSpot correctly returns both parameters:
https://n8n-zkkxp-u32583.vm.elestio.app/rest/oauth2-credential/callback?code=na3-3a20-d2aa-4f89-9786-7435cbc99902&state=test123
This confirms n8n is not generating the state parameter in the initial authorization request.
Share the output returned by the last node
N/A - This is a credential creation issue, not a workflow execution issue.
Debug info
core

n8nVersion: 1.102.4
platform: docker (self-hosted)
nodeJsVersion: 22.17.0
database: postgres
executionMode: scaling (single-main)
concurrency: -1
license: enterprise (production)

storage

success: all
error: all
progress: false
manual: true
binaryMode: filesystem

pruning

enabled: true
maxAge: 168 hours
maxCount: 10000 executions

client

userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/138.0.0.0 safari/537.36
isTouchDevice: false
Generated at: 2025-07-23T18:12:09.854Z

Additional context: Running on Elestio-hosted instance at n8n-zkkxp-u32583.vm.elestio.app. This appears to be a configuration issue with the OAuth2 state parameter generation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions