aws-api-gateway - API Gateway HTTP 集成,如何传递授权标头?
问题描述
我在“集成请求”中。我已经设置了 HTTP 集成类型和端点 URL。下面,我看到“HTTP 标头,但是如果我尝试添加标头,则会出现一个奇怪的“映射自”值,我不明白。设置 HTTP 代理集成添加一个我也不明白的映射模板。
我只需要将原始请求中的 Authorization:xxxx 和 X-Auth-Username:xxxxx 传递给端点
找不到简单的方法...
我设置了 HTTP 代理集成并在 HTTP 标头中添加(并已部署):
method.request.header.Authorization
method.request.header.X-Auth-Username
我还根据需要在 Method 请求标头中添加了 Authoriaxtion 和 X-Auth-Username。但是调用 api 时出现错误:
Authorization header requires 'Credential' parameter.
Authorization header requires 'Signature' parameter.
Authorization header requires 'SignedHeaders' parameter.
Authorization header requires existence of either a 'X-Amz-Date' or a 'Date' header
嗯,也许这是一个“命名”问题?所以我在方法请求中用 MyAuthentication 改变了“授权”,在集成 Header 之后,我将 Authorization 映射到
method.request.header.MyAuthentication
现在,如果我在标题中使用 MyAuthorization 调用我的 api,我会得到“缺少身份验证令牌”,而不会访问 api 服务器
解决方案
推荐阅读
- javascript - 在 JS 中使用 history.pushState 加载页面时后退按钮不起作用
- javascript - html - 使隐藏的拇指出现在单击范围输入滑块的位置
- powershell - 如何归档名称来自 Max lastwritetime 和 Min lastwritetime 的文件
- .net - Dockerized API 通过 Postman 返回套接字挂起
- excel - 使用 VBA 从 Excel 复制/粘贴到 PowerPoint 的位置和大小问题
- mongodb - 使用 $In 运算符查询并限制加载的数据量
- java - 如何在 Thymeleaf 中单击表格行时显示上下文菜单
- broom - Augment a mable:使用 ARMA 误差模型回归的残差和创新是相同的
- flutter - Flutter 错误:不支持的操作:Infinity 或 NaN toInt(在paint() 期间抛出了以下 UnsupportedError :)
- django - 静态文件在真正的 Django 服务器上不起作用