Loading

Invalid token in JWT validation policy after changing from bearer token from jwt custom expression

Fecha de publicación: Aug 6, 2025
Solución

SYMPTOM

During the configuration of the JWT validation policy you may encounter an error:
{
"error": "Invalid token."
}

And you are seeing this message after changing the validation from bearer token that worked without a problem to a custom token expression

CAUSE

This is a common error following the documentation after changing the bearer token to jwt custom token, it is not explained in the documentation since it is taking for granted the difference in the tokens.

SOLUTION

You are still using the bearer token instead of just sending the token. Bearer tokens and common tokens are different things so there is no need to send the "bearer" as the same as when you were using the authentication bearer for the JWT validation policy. This is explained in the documentation as: 
If you set this field to HTTP Bearer Authentication Header, the JWT is expected as Bearer.
If you set this field to Custom Expression, provide a DataWeave expression that returns the token.
Número del artículo de conocimiento

001122509

 
Cargando
Salesforce Help | Article