Change REST API Gateway lambda authorizer response

0

Currently, I return this

{
          "principalId": "user",
          "policyDocument": {
            "Version": "2012-10-17",
            "Statement": [
              {
                "Action": "execute-api:Invoke",
                "Effect": "Allow" if isAuthorized else "Deny",
                "Resource": self.resource
              }
            ]
          }
        }

I get a message like this now in the authorizer response body if unauthorized,

{
    "message": "Unauthorized"
}

How can I manipulate this so that the message when unauthorized is changed?

1 回答
0

Have a look at this: https://repost.aws/knowledge-center/api-gateway-401-error-lambda-authorizer, as it could be issues with configuration or usage/lack of tokens.

Also double check whether you resource policy may have a role into this.

profile picture
专家
已回答 1 个月前
  • There is no issue with the authorizer. It works fine. I just want to find a way to manipulate the unauthorized response body

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则