Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add OAuth2/OpenID compatible middleware to Swagger
public void ConfigureServices(IServiceCollection services)
{
// Other settings
services
.AddSwaggerGen(c =>
{
// Other settings
c.AddSecurityDefinition("oauth2", new OAuth2Scheme
{
Type = "oauth2",
Flow = "implicit",
AuthorizationUrl = Configuration
.GetSection("Authority").Value,
Scopes = GetScopes("my_api")
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.