SwaggerBasicAuthMiddleware for securing swagger docs does not work with jwt authorize authentication

Tony 61 Reputation points
2023-02-23T21:23:50.2466667+00:00

Good day guys,

I have been trying to secure swagger docs using SwaggerBasicAuthMiddleware where it will authenticate the user before accessing the documentation and viewing of the methods. This part does work well. But the other part where i want to use jwt for accessing the methods and sending of post requests. Does not work having both. if i remove the SwaggerBasicAuthMiddleware for authentication of swagger ui. It starts to work with jwt and i can send request and get the token.

for example this is the secured part which works well.

User's image

But after accessing the the docs and methods. The authentication method to authorize the api with jwt does not work.

any help will be appreciated

thank you

Developer technologies | ASP.NET Core | Other
Developer technologies | ASP.NET Core | ASP.NET API

1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    3 deleted comments

    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.