1

I have added header in individual route for sending token but what i am trying is , adding token in Authorize in swagger ui once so that I don't have to send token in header in every individual route.enter image description here

I have tried with adding securityDefinitions as show in image but when i console the request object in nodejs server , the header option didnot appeared .

  • I think you need to add the security definition to each route – Sohan May 13 '19 at 10:26
  • Also what is the version of swagger you are using? – Sohan May 13 '19 at 10:29
  • i have been using swagger 2.o version – sabin shrestha May 14 '19 at 11:21
  • As you said if i add security option to each route it works but I am trying to avoid writing token to individual route once we logged in. Can't we add token once in header and avoid writing token for individual route instead ? – sabin shrestha May 14 '19 at 11:23
  • i don't think swagger docs support that way of authorization. This was my similar concern but i ended up doing adding header at each path . Anyway it is dynamic it does not impact on performance. Once you have token you just iterate and add the definition. – Sohan May 14 '19 at 11:35
  • Also show me how are you adding definition to each routes? i can check if there is better way – Sohan May 14 '19 at 11:38

0 Answers0