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

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ