aws-api-gatewaycustom-authentication

AWS API Gateway custom Authorizer strange showing error


Here is the context:

The problem:

{
  "message": "User is not authorized to access this resource"
}

In addition, I have disabled cache for the authorizer.

enter image description here

What might have caused this issue?


Solution

  • This could be fixed in two ways that are described in buggy's answer: https://forum.serverless.com/t/rest-api-with-custom-authorizer-how-are-you-dealing-with-authorization-and-policy-cache/3310

    Short version:

    1. Set custom authorizer policy resource as "*"
    2. Or (if you are ok with no caching) set TTL for custom authorizer to 0

    See the answer by Michael for more details