// guides · n8n error index

n8n Webhook authentication not working? 401, 403 and JWT, 28 tests

Why n8n Webhook Basic, Header or JWT auth rejects your request: 401 vs 403 messages, an exact case-sensitive header value, no query keys, the Bearer prefix, expired tokens, a 500 with no credential and a browser popup. 28 real requests on n8n 2.43.7.

Updated 2026-10-25 · about 10 minutes

Still stuck after these steps? Paste your exact n8n error and we'll reproduce it and email you the fix, free →

Steps

  1. Read the status and message: they tell you which check failed

    We sent 28 requests to a published Webhook node (v2) on n8n 2.43.7. Each auth type answers with its own message. Basic Auth: 401 Authorization is required! when no credentials arrive, 401 Authentication data is wrong! for a wrong user or password. Header Auth: always 403 Authorization data is wrong!, also when the header is missing. JWT Auth: 401 No token provided, or 403 jwt expired, invalid signature or jwt malformed. A 500 No authentication data defined on node! means the node has an auth type but no credential selected: open the node, pick or create the credential, and publish again.

  2. Header Auth: send the exact value, in a header

    Header Auth compares one header with one exact value. The header name is case-insensitive (x-api-key worked for X-API-Key), but the value is not: with the credential value Bearer tok-9, both tok-9 and bearer tok-9 got 403. A value wrapped in quotes also failed; a trailing space was fine because HTTP strips it. If you store Bearer xyz in the credential, the caller must send exactly Authorization: Bearer xyz; if you store only xyz, the caller must send only that.

  3. API key in the URL? Header Auth ignores the query string

    Sending the key as ?X-API-Key=k-123 got 403: Header Auth reads headers only. If the calling service can only put a key in the URL, set Authentication to None and check it yourself: an IF node on {{ $json.query.key }}, then a Respond to Webhook node returning 401 on the false branch (we did not run this setup). Use a long random key, since URLs end up in logs.

  4. Basic Auth: the caller must send Basic, not Bearer

    Basic Auth worked with curl -u user:password, with credentials in the URL (https://user:pass@host/webhook/..., which curl turns into the header) and even with a lowercase basic scheme. Sending Authorization: Bearer <password> got 401 Authorization is required!, as if nothing was sent. Wrong user and wrong password give the same message, so check both.

  5. JWT Auth: add the Bearer prefix, watch exp

    The JWT credential (HS256 passphrase in our tests) expects Authorization: Bearer <token>. The bare token without Bearer got 401 No token provided, the same as no header at all. An expired token gave 403 jwt expired; a token signed with another secret gave invalid signature, so check the passphrase matches the signer exactly. A token with no exp claim was accepted and never expires: give your tokens an expiry. On success the claims are in $json.jwtPayload. Signing tokens in n8n: n8n JWT node not working.

  6. Browser shows a username and password popup

    Every auth failure, including Header and JWT, came back with WWW-Authenticate: Basic realm="Webhook". Opening a Header or JWT protected webhook in a browser therefore shows a login popup that can never succeed. That is expected: test protected webhooks with curl or the calling service, not the address bar.

  7. Still 404? Auth is checked after the URL

    A call to the test URL /webhook-test/... while the editor was not listening got 404 before any auth check. Fix the URL first (published workflow, production /webhook/ path, right method): see n8n webhook not working (404).

What we ran

On 25 October 2026 we sent 28 curl requests to self-hosted n8n 2.43.7 (n8n start), Webhook node v2 on production URLs, workflows published via the CLI. Credentials: Basic Auth (alice / s3cret), Header Auth (X-API-Key = k-123, and Authorization = Bearer tok-9) and JWT Auth with an HS256 passphrase. We recorded the exact status and body of each reply.

RequestWhat n8n answered
Basic Auth, correct curl -u alice:s3cret200, workflow runs
Basic Auth, no Authorization header401 Authorization is required! + WWW-Authenticate: Basic realm="Webhook"
Basic Auth, wrong password401 Authentication data is wrong!
Basic Auth, wrong user name401 Authentication data is wrong! (same message as a wrong password)
Basic Auth, credentials in the URL https://alice:s3cret@host/...200 (curl turns them into the header)
Basic Auth, scheme written lowercase basic200
Basic Auth, Authorization: Bearer s3cret sent instead401 Authorization is required!
Header Auth X-API-Key: k-123, correct200
Header Auth, header name in lowercase x-api-key200 (header names are case-insensitive)
Header Auth, header missing403 Authorization data is wrong! (403, not 401, even when missing)
Header Auth, wrong value403 Authorization data is wrong!
Header Auth, key sent as query parameter ?X-API-Key=k-123403 (the query string is not checked)
Header Auth, trailing space after the value200 (HTTP strips trailing whitespace)
Header Auth, value wrapped in quotes403
Header Auth name Authorization, value Bearer tok-9, sent exactly200
Same credential, sent as Authorization: tok-9 (no Bearer)403
Same credential, sent as Authorization: bearer tok-9403 (exact, case-sensitive value match)
JWT Auth (HS256 passphrase), valid Bearer token200, claims in $json.jwtPayload
JWT Auth, no Authorization header401 No token provided
JWT Auth, expired token403 jwt expired
JWT Auth, token signed with another secret403 invalid signature
JWT Auth, token sent without the Bearer prefix401 No token provided
JWT Auth, token with no exp claim200 (accepted, never expires)
JWT Auth, garbage token403 jwt malformed
Basic, Header or JWT chosen but no credential selected (3 runs)500 No authentication data defined on node!
Test URL /webhook-test/... while the editor is not listening404 not registered, auth is never reached

Your secret is saved in every execution

After a successful call, the secret was still in the item: $json.headers.authorization (the Basic base64 or the Bearer JWT) and $json.headers["x-api-key"]. It is stored in the execution history and passed to every later node. Remove headers with an Edit Fields node right after the Webhook, or do not save successful executions for that workflow.

Checklist

Receiving files on the protected webhook? See n8n Webhook file upload and binary data.

Good to know

What we did not test

JWT with PEM keys or RS256, the JWT required-claims options, the IF plus Respond to Webhook pattern for query keys, the editor UI and n8n Cloud.

FAQ

Why does my n8n webhook return 403 Authorization data is wrong?

Header Auth answers 403 for a missing header, a wrong value, a value with different case, a key sent in the query string, or a value in quotes. Send the exact credential value in the configured header.

Why does my n8n webhook return 401 Authorization is required?

Basic Auth got no Basic credentials. A Bearer header counts as nothing. Send curl -u user:password or an Authorization: Basic header.

Why does n8n JWT webhook auth say No token provided?

The Authorization header is missing or lacks the "Bearer " prefix. Send Authorization: Bearer followed by the token.

What does No authentication data defined on node mean in n8n?

The Webhook node has Basic, Header or JWT auth selected but no credential chosen. It returns 500 until you select one and publish.

Can n8n Webhook Header Auth read an API key from the URL?

No. In our tests ?X-API-Key= got 403. Check query keys yourself with an IF node and Respond to Webhook.

Why does my browser ask for a password on an n8n webhook?

Every auth failure, even for Header and JWT auth, sends WWW-Authenticate: Basic. Test with curl instead.

Related guides

New guides

Still stuck on your n8n error?

Paste the exact error and say what the workflow should do. We reproduce it on a real n8n install and email you the fix or a working workflow, usually within 24h. Free while we're in beta.

We'll only email you about your error and TaskToAgent.