要使用该API,用户需要进行身份验证,然后将SESSIONID cookie添加到其浏览器中,该cookie将用于请求+ sessionToken查询参数。
如何告诉Swagger对于每个请求都需要一个sessionToken查询参数?我可以添加全局查询参数吗?
答案 0 :(得分:1)
openapi: 3.0.0
# 1) Define the key name and location
components:
securitySchemes:
ApiKeyAuth: # arbitrary name for the security scheme
type: apiKey
in: query # can be "header", "query" or "cookie"
name: sessionToken # name of the header, query parameter or cookie
# 2) Apply the API key globally to all operations
security:
- ApiKeyAuth: [] # use the same name as under securitySchemes
https://swagger.io/docs/specification/authentication/api-keys/