You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法通过Mock Integration配置AWS API Gateway映射以完成Okta验证

解决Okta Event Hook验证与API Gateway Mock响应问题

一、正确配置GET方法的Mock Integration映射模板

要实现读取x-okta-verification-challenge请求头并返回指定JSON响应,按以下步骤操作:

  • 进入API Gateway控制台,找到目标GET方法,切换到Integration Request标签
  • 展开Mapping Templates,点击Add mapping template,输入application/json并勾选Yes, secure this integration
  • 在模板编辑框中输入以下Velocity模板代码:
{
  "verification": "$input.params('x-okta-verification-challenge')"
}
  • 切换到Integration Response标签,找到200状态码的响应设置:
    • 展开Mapping Templates,添加application/json模板,输入$input.path('$')(让API Gateway将Mock返回的内容原样输出)

二、修复本地测试响应体为空的问题

你之前的模板问题出在Mock响应映射配置缺失,按以下调整:

  • 确保Integration Response的200状态码下,已配置application/json映射模板,内容为$input.path('$')
  • 使用API Gateway测试工具时,在Headers栏添加x-okta-verification-challenge: test-challenge-value,发送请求后应返回{"verification": "test-challenge-value"}
  • 若仍无响应体,排查以下点:
    • 检查Mapping Templates的语法,确保引号、括号无错误
    • 确认API Gateway已部署到对应阶段,未部署的配置不会生效

三、补充说明

  • Okta的Event Hook验证仅发送GET请求,POST方法无需处理验证逻辑,只需负责接收事件消息并转发到SQS
  • 建议先通过API Gateway测试工具验证GET方法响应正常,再配置Okta的Event Hook端点

内容的提问来源于stack exchange,提问作者user2519653

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 20:03:11