typescript-rest-swagger securitydefinition bearer token

Viewed 524

Working with typescript-rest I have integrated swagger which is package for typescript rest is typescript-rest-swagger

I am trying to integrate the Bearer token into swagger but it is not working.

Once I comment authorization middleware It start working on. Other than token swagger works fine.

My swagger configuration file looks like

  • swagger.config.yml
swagger:
  outputDirectory: ./dist
  entryFile:
    - ./src/controller/*
  outputFormat: OpenApi_3
  name: Automation API
  produces: [application/json]
  version: 0.0.1
  securityDefinitions:
    BearerAuth:
      type: apiKey,
      name: Authorization,
      scheme: bearer,
      in: header

It is related to tags 'typescript-rest-swagger' & 'typescript-rest' but due to limitation in stackoverflow is not allowing me to add tags

1 Answers

Try using default schema, something like this:

swagger:
  outputDirectory: ./dist
  entryFile:
    - ./src/controller/*
  outputFormat: OpenApi_3
  name: Automation API
  produces: [application/json]
  version: 0.0.1
  securityDefinitions:
    default:
      type: apiKey,
      name: Authorization,
      in: header

Works for me with typescript-rest-swagger

Related