issue in error message when no audience field present
See original GitHub issueCurrently, 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:
- Created 3 years ago
- Comments:6
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This turned out to be a dependency issue - closing this ticket
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.