Last active
May 13, 2018 08:01
-
-
Save iwannabebot/35cc02f21da4cb52763efa298d00d04f to your computer and use it in GitHub Desktop.
Add OAuth2/OpenID compatible middleware to Swagger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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