question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

issue in error message when no audience field present

See original GitHub issue

Currently, I’m receiving the following error message:

Error validating identity token: Microsoft.IdentityModel.Tokens.SecurityTokenInvalidAudienceException: IDX10214: Audience validation failed. Audiences: 'System.String'. Did not match: validationParameters.ValidAudience: 'System.String' or validationParameters.ValidAudiences: 'System.String'.
   at Microsoft.IdentityModel.Tokens.Validators.ValidateAudience(IEnumerable`1 audiences, SecurityToken securityToken, TokenValidationParameters validationParameters)
   at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateTokenPayload(JwtSecurityToken jwtToken, TokenValidationParameters validationParameters)
   at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
   at IdentityModel.OidcClient.IdentityTokenValidator.ValidateSignature(String identityToken, JwtSecurityTokenHandler handler, TokenValidationParameters parameters)
   at IdentityModel.OidcClient.IdentityTokenValidator.ValidateAsync(String identityToken, CancellationToken cancellationToken): ArgumentException
[...]

When trying to validate a JWT with the payload:

{
  "sub": "e1d79921-0795-4111-afee-431b1b411a74",
  "event_id": "431d9076-78a1-4d63-b431-4612c2ddb842",
  "token_use": "access",
  "scope": "openid profile email",
  "auth_time": 1588693872,
  "iss": "[CENSORED]",
  "exp": 1588697472,
  "iat": 1588693872,
  "version": 2,
  "jti": "ba3837df-16d1-48b2-a3e6-ce9aafe1e455",
  "client_id": "[CENSORED]",
  "username": "asdfasdf"
}

as there is no audience, the field should not be validated per the JWT spec. However, I’m not really able to dig into what’s going on without more info from that error message. It looks like it’s being thrown here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
hauntingEchocommented, May 5, 2020

This turned out to be a dependency issue - closing this ticket

0reactions
DaleMckeowncommented, Feb 17, 2023

For anyone else who might come across this issue in the future, it can also present itself in this manner if the AAD secret does not match.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure authentication Audience validation failed
Error message says that Authentication middle ware is not able to authenticate request successfully as Audience in the token is not part of ......
Read more >
Common error messages and workarounds – Knowledge Base
Creating or editing Facebook campaigns ... Campaign processing fails with: Audience "#Adset Name#", Creative "Creative name": You don't have ...
Read more >
Error Messages: Examples, Best Practices & Common ...
Useful error messages can keep users on your site and increase conversions. See examples and learn the best practices.
Read more >
SecurityTokenInvalidAudienceEx...
As far as I know, this error clearly states that audience that came in your SAML-token is different from the value in your...
Read more >
Troubleshoot SAML Configurations
This error occurs if the value of the audience element from the identity provider's SAML response doesn't match the value expected by Auth0....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found