dotnet / dotnet/AspNetCore.Docs
`OpenApiSecurityScheme` for auth token input field in interactive swagger UI documentation
- Dominant language
- C#
- Stars
- 13.1k
- Forks
- 24.6k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 97
Description
### Description
I don't see `OpenApiSecurityScheme` which allows `Swashbuckle.AspNetCore.SwaggerUI` interactive documentation to add authentication token after logging in to use protected resources. Previously:
```
builder.Services.AddSwaggerGen(c =>
{
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Scheme = "Bearer",
In = ParameterLocation.Header,
Description = "Please insert JWT with Bearer into field",
Name = "Authorization",
Type = SecuritySchemeType.ApiKey
});
}
```
### Page URL
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/aspnetcore-openapi?view=aspnetcore-9.0&tabs=visual-studio%2Cvisual-studio-code
### Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/openapi/aspnetcore-openapi.md
### Document ID
27bad30c-e0b4-10fb-b202-a29d4f8fad24
### Platform Id
11e029f8-4c25-d943-fe65-31bfcaf35e2b
### Article author
@captainsafia
### Metadata
* ID: 27bad30c-e0b4-10fb-b202-a29d4f8fad24
* PlatformId: 11e029f8-4c25-d943-fe65-31bfcaf35e2b
* Service: **aspnet-core**
* Sub-service: **fundamentals**
[Related Issues](https://github.com/dotnet/AspNetCore.Docs/issues?q=is%3Aissue+is%3Aopen+27bad30c-e0b4-10fb-b202-a29d4f8fad24)
Contributor guide
Assessment
This issue has not been assessed yet.