Skip to content

Custom Auth Credential Sends JSON Body Despite application/x-www-form-urlencoded Header #21898

Description

@joannamarquezjohnson

Bug Description

When using a Custom Auth credential in n8n with the Content-Type header set to application/x-www-form-urlencoded, the request body is still sent as JSON. This causes compatibility issues with APIs that strictly require form-encoded bodies for authentication or token refresh.

To Reproduce

  1. Create a Custom Auth credential with the following JSON:
{
  "headers": {
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "body": {
    "grant_type": "refresh_token",
    "client_id": "my-client-id",
    "client_secret": "my-client-secret",
    "refresh_token": "my-refresh-token"
  }
}
  1. Use this credential in an HTTP Request node with:
  1. Observe that the request fails with a 400 error and a message indicating that required parameters (e.g., client_id) were not supplied.

Expected behavior

The body should be sent as application/x-www-form-urlencoded when the header is explicitly set and the body is defined as key-value pairs.

Debug Info

The body is sent as JSON, which causes the API to reject the request.

Operating System

alpine-minirootfs-3.22.1-x86_64

n8n Version

1.110.0

Node.js Version

22.19

Database

SQLite

Execution mode

main (default)

Hosting

self hosted

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs FeedbackWaiting for further input or clarification.closed:working-as-expectedSomething is working as designed / expectedstatus:in-linearIssue or PR is now in Linear

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions