I use Swashbuckle to documentation of WebAPI controllers. Also I use OAuth2 with Client Credentials Flow. So to authorize I need to pass client_id
and client_secret
.
I have following code:
config.EnableSwagger(c => {
c.SingleApiVersion("v1", "My API");
c.OAuth2("oauth2")
.Flow("application")
.TokenUrl("/oauth2/token");
c.OperationFilter<AssignOAuthSecurityRequirements>();
})
.EnableSwaggerUi(c => {
c.EnableOAuth2Support(clientId: "clientIdValue", clientSecret:"clientSecretValue", "", "");
c.CustomAsset("index", Assembly.GetExecutingAssembly(), "WebAPI.Swagger.UI.index.html");
});
Authorization works fine but my client_id
and client_secret
values are hardcoded(clientIdValue, clientSecretValue). How can I add possibility to input that values by user in this dialog? Can anyone help me?
Please let me know if I need to post code of AssignOAuthSecurityRequirements
too. Thanks all in advance