Repository navigation
Is it possible to allow an additional custom audience for JWT client authentication in Keycloak 26.6.4? #55507
Replies: 3 comments
|
There isn’t an extra-audience allowlist in the built-in One easy-to-miss detail: allowing multiple audiences is different from allowing an arbitrary audience. The validation code still requires a match against that expected list, so the multiple-audiences option won’t make your custom-only value pass. An access-token audience mapper won’t change validation of an incoming client assertion either. So for the setup you described, fixing the client’s assertion audience is the straightforward route. If that genuinely cannot be changed, accepting the extra value would require custom authentication-provider logic rather than an Admin Console allowlist. Keep it scoped to the intended client and retain signature, expiry and replay validation; don’t disable audience validation globally. AI-assisted; checked against the 26.6.4 source, not tested against a running Keycloak instance. |
|
No, Keycloak 26.6.4 doesn't have a built-in config option or Admin Console setting to whitelist extra custom audience values for In Since you can't change the client application, you'll need a custom |
|
No, there is no supported config for this. Since 26.2 Keycloak strictly validates the |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
We are currently using Keycloak 26.6.4 and would like to confirm whether it is possible to configure additional accepted audience values for JWT client authentication (
client_secret_jwt).Our client authenticates using a JWT (
client_assertion) signed with a client secret (HS256) to obtain an access token using theclient_credentialsgrant type.We have confirmed that authentication succeeds when the
audclaim is set to either of the following values:1. Issuer URL
https://auth.example.com/realms/oauth2. Standard Token Endpoint URL
https://auth.example.com/realms/oauth/protocol/openid-connect/tokenHowever, one of our client applications generates the following custom audience value:
https://auth.example.com/realms/oauth/protocol/openid-connect/token/oauth/v1/tokenWhen we tested this audience in our development environment, the access token request failed with the following response:
{ "error": "invalid_client", "error_description": "Invalid token audience" }HTTP Status: 400 Bad Request
The access token request itself was sent to the standard Keycloak Token Endpoint URL. The custom URL was used only as the
audclaim in theclient_assertion.We reviewed the Keycloak upgrading guide regarding the stricter audience validation introduced in Keycloak 26.2.0, but could not find a standard configuration option for explicitly allowing additional custom audience values.
We would like to clarify the following:
We understand that changing the client application's audience to the Issuer URL or standard Token Endpoint URL would be preferable. However, we would also like to understand whether Keycloak can accommodate this custom audience in cases where the client application's configuration cannot be changed.
Any guidance or references to relevant documentation would be greatly appreciated.
Thank you!
All reactions