AWS API Gateway自定义授权器未运行 [英] AWS API Gateway Custom Authorizer not running

查看:104
本文介绍了AWS API Gateway自定义授权器未运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Lambda函数,该函数已根据我的API端点之一的方法请求配置为自定义身份验证".当我使用AWS API Gateway的测试"功能时,我的Lambda函数在日志输出中看不到任何输出.

I have created a Lambda function which I've configured as the 'custom auth' on the method request of one of my API endpoints. When I use the 'test' function of the AWS API Gateway I don't see any output from my Lambda function in the log output.

我已经部署"了该API.

I have 'deployed' the API.

但是 发生了,因为当我使用配置的自定义域名访问api端点时,我得到了

However something is happening because when I hit the api endpoint using the configured custom domain name I get

{"message":"Unauthorized"}

{"message":"Unauthorized"}

但是,如果我从此端点中删除自定义身份验证"并点击了相同的端点,它将起作用!

However if I remove the 'custom auth' from this endpoint and hit the same endpoint, it works !

我已启用cloudwatch日志记录,这似乎表明未 调用lambda函数,但apiGateway日志组下也没有任何内容,但是必须发生某些情况,我可以看不到.

I've enabled the cloudwatch logging and this seems to show that the lambda function is not invoked but there's nothing under the apiGateway log group either, but, something must be happening, I just can't see it.

有人可以指出我的调试方向吗?

Can anybody point me in the direction of how I debug this ?

推荐答案

  1. API网关测试调用功能将不会调用任何授权者,而将直接调用您的集成.
  2. 您可以使用API​​网关控制台上授权者"标签中的授权者测试调用"来独立测试lambda授权者.
  3. 您的lambda函数必须返回一个响应,该响应包括主体标识符(principalId)和包含策略声明列表的策略文档.

有关此内容的更详细的文档,请参见

A more detailed documentation on this can be found here.

Ritisha.

这篇关于AWS API Gateway自定义授权器未运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆