Closed 5wdgJibXS7DEE closed 3 years ago
Indeed Swagger UI do not respond well to the way the swagger.json file was generated with the use of AddAuthorizationHeaderParameterOperationFilter
and/or AuthTokenOperation
as you guessed correctly.
In order to make sure of that, I tested Swagger UI with a swagger.json I created manually. The UI works fine:
They are changes in the UI/UX:
My point of view is that this change is for the best. It simplifies the use of the API for testing. Here is a screenshot:
After a quick read of Swashbuckle docs I think I can generate a similar swagger.json using AddSecurityRequirement
in configuration.
@ttu Is it fine for you if I go this way?
Thanks for the inspecting the issue.
Using AddSecurityDefinition
is the normal way to add authentication to Swagger. Not sure why I didn't go that way in the beginning. Maybe wanted to have authentication endpoints visible from Swagger so it is more clear for people who are not familiar with Swagger what kind of functionality backend provides. Or just couldn't get it working any other way... Can't be sure anymore 😄
Yes, try to add authentication by configuring Swashbucle 👍 . Logout endpoint might still be needed as blacklisting the tokens is a custom functionality. Swagger logout doesn't call that endpoint by default.
@ttu I let you know that I'll have time to work on it this week-end :)
On branch
update-to-core-30
the endpoints under Authentification tag in Swagger UI are unusable with various symptoms on the following browsers :Those endpoints work fine with cURL commands. The problem comes from Swagger UI.
Note: on branch
master
with .NET Core 2.2, despite the web browser receives the auth token, the Swagger UI does not display the response. Is it important to fix that, or should we focus our effort on .NET Core 3?