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 Respuesta
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
EXPERTO
respondido hace 2 meses
  • There is no issue with the authorizer. It works fine. I just want to find a way to manipulate the unauthorized response body

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas