n8n-io/n8n · error · ChatTriggerAuthorizationError

Authorization is required!

Error message

Authorization is required!

What it means

The Chat Trigger is configured for Basic Auth and the incoming webhook request has no HTTP 'Authorization' header. basicAuth(req) (from the 'basic-auth' library) returns undefined, so the node throws ChatTriggerAuthorizationError(401). This is a client-side error: the caller did not supply credentials.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/GenericFunctions.ts:31

	const headers = context.getHeaderData();

	if (authentication === 'none') {
		return;
	} else if (authentication === 'basicAuth') {
		// Basic authorization is needed to call webhook
		let expectedAuth: ICredentialDataDecryptedObject | undefined;
		try {
			expectedAuth = await context.getCredentials<ICredentialDataDecryptedObject>('httpBasicAuth');
		} catch {}

		if (expectedAuth === undefined || !expectedAuth.user || !expectedAuth.password) {
			// Data is not defined on node so can not authenticate
			throw new ChatTriggerAuthorizationError(500, 'No authentication data defined on node!');
		}

		const providedAuth = basicAuth(req);
		// Authorization data is missing
		if (!providedAuth) throw new ChatTriggerAuthorizationError(401);

		if (providedAuth.name !== expectedAuth.user || providedAuth.pass !== expectedAuth.password) {
			// Provided authentication data is wrong
			throw new ChatTriggerAuthorizationError(403);
		}
	} else if (authentication === 'n8nUserAuth') {
		const webhookName = context.getWebhookName();

		if (webhookName !== 'setup') {
			function getCookie(name: string) {
				const value = `; ${headers.cookie}`;
				const parts = value.split(`; ${name}=`);

				if (parts.length === 2) {
					return parts.pop()?.split(';').shift();
				}
				return '';
			}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Send the request with a Basic Authorization header: Authorization: Basic <base64(user:password)>.
  2. With curl: curl -u user:pass <webhook-url>.
  3. If a reverse proxy sits in front of n8n, configure it to forward the Authorization header.

Example fix

// before: fetch(webhookUrl, { method: 'POST', body })
// after:  fetch(webhookUrl, { method: 'POST', body, headers: { Authorization: 'Basic ' + btoa('user:pass') } })
Defensive patterns

Strategy: validation

Validate before calling

// Caller-side: build the Authorization header before sending.
const token = Buffer.from(`${user}:${pass}`, 'utf8').toString('base64');
if (!user || !pass) throw new Error('user/pass required for Basic Auth');
await fetch(url, { headers: { Authorization: `Basic ${token}` } });

Prevention

When it happens

Trigger: authentication === 'basicAuth', httpBasicAuth credential is valid, but basicAuth(req) returns a falsy value because the request lacks an 'Authorization: Basic <base64(user:pass)>' header.

Common situations: Calling the chat webhook URL via curl without -u, fetch/axios without an Authorization header, an embedded chat widget that strips headers, or a proxy/load-balancer removing the Authorization header before it reaches n8n.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/0239248aac6de325. Report an issue: GitHub.