1

I have create a route that showing openAPI documentation in expressjs using the @wesleytodd/openapi package. The route successfully showing my documentation but I want to set a form that if user wants to see my documentation they must have to log in first (I set for them).

May be it looks like in this question: HTTP authentication cpanel

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
  • Your edit was reverted for a reason - you've marked the question as solved already by accepting the answer below, and if you want to write in more detail how you applied that you can write another answer of your own. The question should just contain the question, not answers. – jonrsharpe Jun 08 '21 at 15:10

1 Answers1

0

Welcome to StackOverflow

you can make use of a button, it will depend on your SecuritySchemes authentication as well the generator you are using

enter image description here

and when pressing the button, you will get

enter image description here

images above are from SwaggerHub platform

balexandre
  • 73,608
  • 45
  • 233
  • 342
  • I know about authorization or security setup for openAPI in case it's used to authorize user when try the API. But what I want to do is setup login form so my user must **login first** before see my documentation. – Ivan Azis Nabawi May 20 '21 at 14:41
  • wouldn't then makes more sense to have your documentation inside your own application, where they can see their credentials for example?... as I'm used to NodeJs, a [simple route with basic auth](https://stackoverflow.com/a/33905671/28004) would accomplish it... – balexandre May 20 '21 at 14:50
  • wuppss.. will try it, looks legit for my problem. – Ivan Azis Nabawi May 20 '21 at 14:53