'I want scope checkbox checked by default swagger Nswag
Here is Swagger/OpenAPI definition:
services.AddOpenApiDocument(document =>
{
document.DocumentProcessors.Add(new SecurityDefinitionAppender("Bearer", Enumerable.Empty<string>(),
new OpenApiSecurityScheme
{
Type = OpenApiSecuritySchemeType.OAuth2,
Flow = OpenApiOAuth2Flow.AccessCode,
Scopes = new Dictionary<string, string> {{"myScope", "myScope"}},
AuthorizationUrl = "redacted",
TokenUrl = "redacted"
}));
});
and Swagger-UI configuration options:
app.UseSwaggerUi3(settings =>
{
settings.OAuth2Client = new OAuth2ClientSettings
{
ClientId = "MyClientID",
ClientSecret = string.Empty,
AppName = "My App",
UsePkceWithAuthorizationCodeGrant = true
};
});
I want that scope should be checked by default, Is this possible?
Solution 1:[1]
You can do it in version 6.0 by OAuthScopes
method.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mohammad Roshani |