Steps
The Payload Claims fields do not set exp, sub, aud or iss
This is the biggest trap. Signing with the Payload Claims fields Expires In
3600, Subjectu1, Audienceapi://xand Issuern8ngave a green run, but the payload was{"audience":"api://x","expiresIn":3600,"issuer":"n8n","subject":"u1","iat":...}. Those are plain keys, not the registered claims, so there is noexp,sub,audoriss: the token never expires and an API that checkssuboraudrejects it. The fix we ran: turn on Use JSON to Build Payload and set Payload Claims (JSON) to an expression like{{ JSON.stringify({sub: $json.email, role: $json.role, exp: Math.floor(Date.now()/1000)+3600}) }}. That gave{"sub":"ann@example.com","role":"admin","exp":...,"iat":...}. With no claims at all the payload is only{"iat":...}.exp must be a number of seconds
expbuilt withDate.now()+3600000(milliseconds) was accepted silently: the token expires around the year 58,800, so it never expires in practice. Divide by 1000 and round, as above.expas a string,"1893456000", failed with"exp" should be a number of seconds. Payload Claims (JSON) set to{{ $json }}worked too, but every input field became a claim, so check you are not putting private fields in the token. Relaxed JSON like{ sub: 'u1' }was accepted.Fixed mode puts the braces in the token
With the Payload Claims (JSON) field in Fixed mode,
{"email":"{{ $json.email }}"}signed the literal text{{ $json.email }}, with a green run. Switch the field to Expression. For the header, Header Claims (JSON){"kid":"key-1","typ":"JWT"}setkid, and Options > Key ID did the same. Three input items gave three tokens, one per item.Remove "Bearer " before Verify or Decode
Pasting the token with
Bearerin front into the Token field stopped the workflow before it started:The 'JWT' node has issues: - Value is not a valid JWT token. From an expression it failed withInvalid input for 'Token' [item 0]. The fix we ran:{{ $json.auth.replace(/^Bearer\s+/i, '') }}. In a webhook the header is$json.headers.authorization, see n8n webhook not working. A token with a trailing newline gave the same error, so add.trim(). An empty or missing token gaveThe JWT token was not provided."The JWT token can't be verified": the secret does not match
A wrong secret, the right secret with one trailing space in the credential, and a token whose issuer base64-decoded the secret before signing all failed with
The JWT token can't be verifiedand the hintBe sure that the provided JWT token is correctly encoded and matches the selected credentials. Copy the secret again without spaces, and ask the issuer if their secret is base64 (many providers show it encoded). An empty secret failed at signing withsecretOrPrivateKey must have a value."invalid algorithm": Verify accepts one algorithm only
A token signed HS512 checked with an HS256 credential, an HS256 token with an HS512 credential, and an RS256 token with an HS256 credential all failed with
invalid algorithm. Verify only accepts the one algorithm set in the credential. Options > Override Algorithm fixed it: set to HS512, the HS512 token passed with the HS256 credential. The same option signs with another algorithm. Decode the token first to read thealgin its header.jwt expired and jwt not active
A token that expired two minutes before failed with
jwt expired. Options > Clock Tolerance300let it through, but not a token expired an hour before. Ignore Expiration let any expired token pass. A token withnbfone hour in the future failed withjwt not active, and Ignore Not Before Claim let it pass. One expired token among three items failed the whole node with no output for the two good ones.RS256 and ES256: the key must have its PEM lines
A full PEM private key signed RS256 fine, and so did the same key pasted on one line with spaces. The base64 body without the
-----BEGIN PRIVATE KEY-----and-----END PRIVATE KEY-----lines failed withsecretOrPrivateKey must be an asymmetric key when using RS256, and so did Key Type Passphrase with RS256. Only the public key filled gavesecretOrPrivateKey must have a valuewhen signing. To verify, the public key alone worked, but only the private key gavesecret or public key must be provided. ES256 with an EC key worked; ES256 with an RSA key failed with"alg" parameter for "rsa" key type must be one of: RS256, PS256, RS384, PS384, RS512, PS512.Verify puts the claims under payload, and does not check aud or iss
A good token came out as
{"payload":{...}}, so the next node needs{{ $json.payload.sub }}, not$json.sub. Return Additional Info gaveheader,payloadandsignatureat the top level. A token with anaudandissof another service passed: the node has no option to require them, so check them with an IF node after Verify. With On Error set to continue, a bad token gave one item{"error":"The JWT token can't be verified"}and the input fields were gone.Decode checks nothing
Decode returned the payload of a token signed with the wrong secret and of an expired token, both with green runs. Use it to read a token, never to trust one: use Verify for that. Decode still needs a credential: without one it failed with
Node does not have any credentials set. A Bearer prefix fails Decode the same way as Verify.
What we ran
On 24 October 2026 we ran 54 executions of the JWT node v1 on self-hosted n8n 2.43.7 with n8n execute and 13 test credentials of type JWT Auth (HS256, HS512, a secret with a trailing space, an empty secret, RSA and EC PEM keys in several shapes). Test tokens were made with jsonwebtoken 9.0.3, the library n8n uses. 31 runs succeeded and 23 failed. Keys and secrets were throwaway test values.
| What we ran | Result |
|---|---|
| Sign, no claims | Payload {"iat":...}, HS256 |
| Sign, Payload Claims Expires In, Subject, Audience, Issuer | Keys expiresIn, subject... no exp, green |
Sign, JSON payload with sub, role, exp in seconds | Registered claims set |
Sign, JSON payload {{ $json }} | Every input field is a claim |
Sign, exp in milliseconds | Accepted, never expires |
Sign, exp as a string | Error "exp" should be a number of seconds |
Sign, relaxed JSON { sub: 'u1' } | Accepted |
| Sign, JSON in Fixed mode with braces | Literal {{ $json.email }} in the token |
Sign, Header Claims kid / Options Key ID | kid in the header |
| Sign, empty secret | Error secretOrPrivateKey must have a value |
| Sign RS256, full PEM / PEM on one line | Works |
| Sign RS256, key body without BEGIN/END lines | Error secretOrPrivateKey must be an asymmetric key when using RS256 |
| Sign RS256, public key only | Error secretOrPrivateKey must have a value |
| Sign RS256 with Key Type Passphrase | Error secretOrPrivateKey must be an asymmetric key when using RS256 |
| Sign ES256 with an EC key / an RSA key | Works / error "alg" parameter for "rsa" key type must be one of: RS256, PS256, RS384, PS384, RS512, PS512. |
| Sign, Override Algorithm HS512 | HS512 token from an HS256 credential |
| Sign, 3 items | 3 tokens |
| Verify, good token | {"payload":{...}} |
| Verify, wrong secret / trailing space / base64 secret | Error The JWT token can't be verified |
| Verify, expired 2 min | Error jwt expired |
| Verify, expired, Ignore Expiration | Passes |
| Verify, expired 2 min / 1 h, Clock Tolerance 300 | Passes / jwt expired |
| Verify, nbf in 1 h / with Ignore Not Before | Error jwt not active / passes |
Verify, Bearer in the Token field | Not started: Value is not a valid JWT token |
Verify, Bearer from an expression / trailing newline | Error Invalid input for 'Token' [item 0] |
Verify, replace(/^Bearer\s+/i, '') | Passes |
| Verify, empty token | Error The JWT token was not provided |
| Verify, HS512 token with HS256 credential (and the reverse) | Error invalid algorithm |
| Verify, same, Override Algorithm HS512 | Passes |
| Verify, RS256 token with HS256 credential | Error invalid algorithm |
| Verify RS256, public key only | Passes |
| Verify RS256, private key only | Error secret or public key must be provided |
| Verify RS256, key body without BEGIN/END lines | Error secretOrPublicKey must be an asymmetric key when using RS256 |
| Verify, token with another aud and iss | Passes, not checked |
| Verify, Return Additional Info | header, payload, signature |
| Verify, bad token, On Error continue | {"error":...}, input fields gone |
| Verify, 3 items with 1 expired | Whole node fails jwt expired |
| Decode, wrong secret / expired token | Payload returned, green |
Decode, Bearer prefix / not-a-jwt | Error Value is not a valid JWT token |
| Decode, no credential | Error Node does not have any credentials set |
Quick checklist
- No
exporsubin your token? Use JSON to Build Payload, not the Payload Claims fields. expin seconds:Math.floor(Date.now()/1000)+3600.Value is not a valid JWT token? StripBearerand trim.invalid algorithm? Match the credential algorithm to the token, or use Override Algorithm.can't be verified? Re-copy the secret, no spaces, and check if it is base64.- Read claims from
$json.payload, and checkaudandissyourself.
Good to know
- Hashing or HMAC-signing a webhook body instead of a JWT: n8n Crypto node not working.
- Sending the token to an API: n8n HTTP Request node errors covers the Authorization header and 401s.
- Every error message we reproduced is in the n8n error message index.
What we didn't test
- The editor UI itself (we ran workflows from JSON, so labels may differ slightly), n8n Cloud, fetching public keys from a JWKS URL (the node has no JWKS option), real Supabase or Auth0 tokens, PS256, ES384 and ES512.
Start from a working agent
FAQ
Why does my n8n JWT have no exp claim?
The Payload Claims fields Expires In, Subject, Audience and Issuer are written as plain keys (expiresIn, subject...), not as exp, sub, aud and iss. Turn on Use JSON to Build Payload and set exp yourself, in seconds.
What does "Value is not a valid JWT token" mean in n8n?
The Token field holds something that is not a bare JWT, usually "Bearer " in front or a trailing newline. Remove the prefix with replace(/^Bearer\s+/i, '') and add .trim().
Why do I get "invalid algorithm" in the n8n JWT node?
The token was signed with another algorithm than the one in the credential. Verify accepts only that one. Set Options > Override Algorithm to the token's alg, or fix the credential.
Why does n8n say "The JWT token can't be verified"?
The secret or public key does not match the one that signed the token. In our runs a trailing space or a secret that the issuer had base64-decoded gave the same error.
Does the n8n JWT node check audience and issuer?
No. A token with another aud and iss passed Verify in our run. Check $json.payload.aud and $json.payload.iss with an IF node.
Does Decode in the n8n JWT node verify the token?
No. It returned the payload of a token with a wrong signature and of an expired token. Use Verify before you trust the claims.
Related guides
- n8n Google Sheets node not working: Bad request, invalid_grant, private key fixes
- n8n Webhook authentication not working? 401, 403 and JWT, 28 tests
- n8n Crypto node not working: HMAC webhook signatures that never match, missing secret and errors, 57 runs
- n8n Gmail node not working: Client authentication failed, invalid_grant, OAuth2 fixes
- n8n 413 Request Entity Too Large? Payload limits tested
New guides
- GitHub release notifications in Slack (any public repo, stable releases only)
- Send RSS feeds to Slack with a keyword filter (free, incoming webhook)
- Forward emails to a Slack channel (Gmail, Outlook, any IMAP), free with an incoming webhook
- n8n Google Sheets Trigger not working: not firing, activation errors and fixes