Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created July 22, 2019 14:34
Show Gist options
  • Save ntakouris/c83d94dd31aa92f04e7da83bab310f58 to your computer and use it in GitHub Desktop.
Save ntakouris/c83d94dd31aa92f04e7da83bab310f58 to your computer and use it in GitHub Desktop.
var tokenValidationParameters = new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(jwtSettings.Secret)),
ValidateIssuer = false,
ValidateAudience = false,
RequireExpirationTime = false,
ValidateLifetime = true
};
services.AddSingleton(tokenValidationParameters);
services.AddAuthentication(x =>
{
// ...
})
.AddJwtBearer(x =>
{
x.SaveToken = true;
x.TokenValidationParameters = tokenValidationParameters;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment