Problem accessing AWS API (with Lambda) using cognito user pool

I have created AWS API using Proxy and Lambda functions using C#. I have used cognito user pool for authorization. Prior to enabling the authorization everything worked fine. Now when I invoke the API from postman with “Authorization” header and Identity Token as value, I get unauthorized error.

Please help.

Without codes show us, it is hard to do anything.

When I got the unauthorized error, I do these:

  1. check logs if there are any hints.

    serverless logs -f <auth_function_name>

  2. Clean the cache, and set the TTL to 0 to do the troubleshooting. Otherwise, even you change something, the cache still makes it unauthorized.

After fix the problem, don’t forget to change TTL value back.

  1. Go to aws console, do a test directly in api gateway with that auth handler.

Good luck.

1 Like