Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CESARDELATORRE/6a9200a32156414f65f2977825b07831 to your computer and use it in GitHub Desktop.
Save CESARDELATORRE/6a9200a32156414f65f2977825b07831 to your computer and use it in GitHub Desktop.
AddJwtBearer-ConfigureServices.cs
// prevent from mapping "sub" claim to nameidentifier.
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
var identityUrl = Configuration.GetValue<string>("IdentityUrl");
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
{
options.Authority = identityUrl;
options.RequireHttpsMetadata = false;
options.Audience = "basket";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment