Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created July 23, 2019 07:53
Show Gist options
  • Select an option

  • Save ntakouris/fe7cb189d8ed120da2451565e673eabc to your computer and use it in GitHub Desktop.

Select an option

Save ntakouris/fe7cb189d8ed120da2451565e673eabc to your computer and use it in GitHub Desktop.
services.AddSwaggerGen(x =>
{
x.SwaggerDoc("v1", new OpenApiInfo{ Title = "Tweetbook API", Version = "v1" });
x.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Description = "JWT Authorization header using the bearer scheme",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey
});
x.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{new OpenApiSecurityScheme{Reference = new OpenApiReference
{
Id = "Bearer",
Type = ReferenceType.SecurityScheme
}}, new List<string>()}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment