auth0 audience check token code example

Example 1: valid audience token

When validating an ID token, 
you should verify that the aud (Audience) 
claim equals the Client ID of the current application.

Add this to the validation parameters:
ValidateAudience = true,
ValidAudience = "xyz123", // This Application's Client ID

Example 2: valid audience token

If you are validating access tokens, 
you should verify that the aud (audience) claim equals the
audience that is configured for your Authorization Server
in the Okta Developer Console.
For example, if your Authorization Server audience is set to
MyAwesomeApi, add this to the validation parameters:

ValidateAudience = true,
ValidAudience = "MyAwesomeApi",

Tags:

Misc Example