make AuthorizationUrl configurable in swagger ui using Swashbuckle 6.0.5 in asp.net core 3.1

Viewed 635

Is it possible to have a input for AuthorizationUrl when using OAuth2 with Implicit flow as SecurityDefinition in swagger in asp.net core ?

My goal is to make AuthorizationUrl dynamic, so when the user sees the modal for entering clientId for the OAuth2 he can also change AuthorizationUrl .

1 Answers

Neither OpenAPI Specification nor Swagger UI support this. The authorizationUrl is hard-coded and cannot be parameterized. Different OAuth identity providers need to be defined as separate security schemes.

However, authorizationUrl can be defined relative to the API server URL, which itself can be relative to the location of the OpenAPI YAML/JSON file.

Related