簡體   English   中英

如何為每個請求添加 sessionToken 查詢參數?

[英]How to add sessionToken query parameter for each request?

要使用該 API,用戶需要進行身份驗證,將一個 SESSIONID cookie 添加到他的瀏覽器中,該 cookie 將用於請求 + sessionToken 查詢參數。

我如何告訴 Swagger 對於每個請求都需要 sessionToken 查詢參數? 我可以添加全局查詢參數嗎?

 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/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM