Added editing for sending without writing bearer before token values sent in API requests.

This commit is contained in:
veysel mutlu 2021-09-11 10:10:14 +03:00
parent 4bfa1c03df
commit 723bd1209f

View File

@ -277,6 +277,25 @@
}
});
/*
* resource: https://twitter.com/CoderBora/status/1436392448356495362
* Swagger => Authorization: Bearer {token} : DO YOU WANT TO WRITE "Bearer" to the Value each time?
AddSecurityDefinition=>{ in Swagger
Type = SecuritySchemeType Choose "Http" instead of "ApiKey". Avoid typing "Bearer" instead of token
*
*/
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Description = @"JWT Authorization header using the Bearer scheme. Example: \'Authorization: Bearer {token}\'",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.Http,
Scheme = "Bearer"
});
options.OperationFilter<AuthorizeCheckOperationFilter>();
});