1

i am building web api with Swashbuckle.AspNetCore on top. I i have implemented authorization and it works however i need to add custom header or request param to auth request. I do not see a way how to do this. Is there any?

current code is

 c.AddSecurityDefinition("oauth2", new OAuth2Scheme
                {
                    Type = "oauth2",
                    Flow = "password",
                    TokenUrl = $"{configuration.GetSection("Security").GetValue<string>("STSHost")}/connect/token"
                });

1 Answers1

0

There's no way to add custom headers to the authentication requests, but you can add additional query parameters by using the OAuthAdditionalQueryStringParams method.

It takes a dictionary of string keys and values and maps to the additionalQueryStringParams OAuth2 configuration value.

khellang
  • 17,550
  • 6
  • 64
  • 84
  • Thats correct just with new version it is like app.UseSwaggerUI(c => { c.OAuthConfigObject = new OAuthConfigObject { AdditionalQueryStringParams = new Dictionary{ { "aa", "bb" } } }; }); – Vytautas Pranskunas Jan 30 '19 at 08:19