首页 > 其他分享 >swagger3.0请求header中自动屏蔽Authorization解决办法

swagger3.0请求header中自动屏蔽Authorization解决办法

时间:2023-02-08 13:35:54浏览次数:38  
标签:name swagger3.0 OA header type Authorization description

一、原因

 

当全局header参数中包含命名为Accpet、Content-Type、Authorization的参数时,参数的定义将被忽略,需要手动添加。

二、解决办法

  接口上security 参数,指定要放行的权限key

 

三、示例代码

/**
* @OA\SecurityScheme(
* type="apiKey",
* in="header",
* securityScheme="Bearer",
* name="Authorization"
* )
*/

/**
* @OA\Get (path="/detail/index",
* tags={"数据"},
* summary="数据列表",
* security={{"Bearer":{}}},
* @OA\Parameter(name="page", in="query", description="页码", @OA\Schema(type="int", default="1")),
* @OA\Parameter(name="pageSize", in="query", description="行数", @OA\Schema(type="int", default="10")),
* @OA\Response(
* response="200",
* description="成功状态",
* )
* )
*/
通过点击Authorize进行授权访问

 

 

标签:name,swagger3.0,OA,header,type,Authorization,description
From: https://www.cnblogs.com/bpsh/p/17101402.html

相关文章