我试图通过swagger文档中的标头传递承载授权令牌,但我没有收到标头,
这不包括头当我记录请求
/**
* @swagger
* components:
* securitySchemes:
* BearerAuth:
* type: http
* scheme: bearer
* bearerFormat: JWT
* /api/v1/mediator/verify/phone/otp:
* post:
* summary: Verify Phone OTP
* tags: [Users]
* security:
* - BearerAuth: []
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* phone_number:
* type: string
* description: The phone number to verify OTP.
* code:
* type: string
* description: The OTP code to verify.
* responses:
* '200':
* description: Phone OTP verification successful.
* '400':
* description: Bad request - validation failed or phone_number/code not provided.
* '401':
* description: Unauthorized - Missing or invalid token. This endpoint requires a bearer token for authorization.
* '500':
* description: Internal server error.
*/
字符串
这不会弹出任何必填字段让我传递授权令牌
/**
* @swagger
* /api/v1/mediator/verify/email/otp:
* post:
* summary: Verify Email OTP
* tags: [Users]
* security:
* - BearerAuth: []
* parameters:
* - in: header
* name: Authorization
* required: true
* schema:
* type: string
* format: BearerToken
* description: Bearer token for authorization.
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* email:
* type: string
* description: The phone number to verify OTP.
* code:
* type: string
* description: The OTP code to verify.
* responses:
* 200:
* description: Phone OTP verification successful.
* 400:
* description: Bad request - validation failed or email/code not provided.
* 401:
* description: Unauthorized - invalid or missing token.
* 500:
* description: Internal server error.
*/
型
我在这里做错了什么,我使用openapi 3.0.0,当我尝试使用postman时,它工作正常,但在swagger上不工作,我能够从header接收任何参数。
1条答案
按热度按时间u0njafvf1#
以下是更正后的版本:
字符串