Add bearer authentication to your Swagger endpoint

In your .json definition file:

{
  "swagger": "2.0".
  ...
  "securityDefinitions": {
    "bearerAuth": {
      "type": "apiKey",
      "in": "header",
      "name": "Authorization",
    }
  },
  ...
  "paths": {
    "get": {
      "/path": {
        "security": [
          {"bearerAuth": []}
        ],
        ...
      }
    }
  }

official documentation is here: https://swagger.io/docs/specification/authentication/bearer-authentication/

Click Here to Leave a Comment Below

Leave a Reply: