D
D
ddddd tttt2019-04-16 01:03:23
API
ddddd tttt, 2019-04-16 01:03:23

Is it possible to describe my authorization in swagger v3?

{
  "securitySchemes": {
    "cookieAuth": [
      {
        "type": "string",
        "in": "cookie",
        "name": "token"
      },
      {
        "type": "string",
        "in": "cookie",
        "name": "session_id"
      }
    ]
  }
}

How to describe this type of authorization? It is necessary that this data be in cookies, but when I click the authorization button, an empty window appears with the inscription Available authorizations.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
i, 2019-05-11
@pashaa

{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Swagger Sample"
  },
  "components": {
    "securitySchemes": {
      "cookieAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "token"
      },
      "cookieSession": {
        "type": "apiKey",
        "in": "cookie",
        "name": "session_id"
      }
    }
  },
  "security": [
    {
      "cookieSession": []
    },
    {
      "cookieAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://jsonplaceholder.typicode.com"
    }
  ],
  "paths": {
    "/posts": {
      "get": {
        "description": "Returns a list of posts.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question