Skip to content

IDX10206: Unable to validate audience. The 'audiences' parameter is empty #42207

@jeanyves7

Description

@jeanyves7

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When trying to validate the token issued from keycloak in the frontend and sent in the authorization header to the backend to be validated, the request is failing with the following message:
Microsoft.IdentityModel.Tokens.SecurityTokenInvalidAudienceException: IDX10206: Unable to validate audience. The 'audiences' parameter is empty.
at Microsoft.IdentityModel.Tokens.Validators.ValidateAudience(IEnumerable1 audiences, SecurityToken securityToken, TokenValidationParameters validationParameters) at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateAudience(IEnumerable1 audiences, JwtSecurityToken jwtToken, TokenValidationParameters validationParameters)
...

Below is an extract of the code used:
Screenshot 2022-06-15 180234

Expected Behavior

The code should be able to validate the token.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.area-authIncludes: Authn, Authz, OAuth, OIDC, Bearer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions