我有两个API调用登录和注销。 第一次调用(Login)是根据用户名和密码生成令牌。 第二次呼叫需要第一次呼叫生成的令牌。 我如何使用Swagger 3.0为第二次调用设置该令牌?
如果您有任何欢迎的想法,我将这个yaml短代码行作为起点
/auth/credential/login:
post:
tags:
- Credintial login
summary: Logs in and returns the authentication cookie
description: This can only be done by the logged in user.
operationId: createUser
security: []
responses:
'200':
description: >-
Successfully authenticated.
headers:
X-RateLimit-Limit:
schema:
type: integer
description: Request limit per hour.
Set-Cookie:
schema:
type: string
description: Get token value
content:
application/json:
schema:
$ref: '#/components/schemas/Login'
x-forwarded-for:
schema:
$ref: '#/components/schemas/Login'
'202':
description: Life is hard
content:
application/json:
schema:
$ref: '#/components/schemas/LoginRespons'
x-forwarded-for:
schema:
$ref: '#/components/schemas/LoginRespons'
'405':
description: Invalid Login
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Login'
description: Created auth object
required: true
/auth/logout:
post:
tags:
- Logout
summary: Logout a user
description: ''
responses:
'200':
description: Success
content:
'*/*':
schema:
$ref: '#/components/schemas/Logout'
'202':
description: Success Logout!
content:
'*/*':
schema:
$ref: '#/components/schemas/LogoutResponse'
'405':
description: Invalid Logout
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Logout'
description: description