

#REMEMBEAR SOMETHING WENT WRONG WHILE LOGGING IN 401 HOW TO#
To test a Lambda authorizer using Postman or curlįor instructions on how to test a Lambda authorizer using the Postman app, see Call an API with API Gateway Lambda authorizers.įor more information about curl, see the cURL project website. API Gateway returns a Response Code: 200 message. For Request Parameters, enter headerValue1, queryValue1, and stageValue1 and choose Test. API Gateway returns a Response Code: 401 because Request Parameters are missing.Ģ.

Delete the Request Parameters and choose Test. API Gateway returns a Response Code: 200 message.ġ. For the Authorization Token value, enter allow and then choose Test. API Gateway returns a Response Code: 401 because Authorization Token doesn’t satisfy the Token Validation expression.ģ. For example, if you entered the regular expression \ w is configured, enter a value that isn't valid, such as "abc123", as Authorization Token. Important: If you entered a regular expression for Token Validation, then API Gateway validates the token against this expression. The Token Source value must be used as the request header in calls to your API. If Lambda Event Payload is set as Token, then check the Token Source value. Review the authorizer's configuration for one of the following based on your use case: In the navigation pane, under the name of your API, choose Authorizers. On the APIs pane, choose the name of your API.ģ. Resolution Review the Lambda authorizer's configurationĢ. Note: For example Lambda authorizer setups, see Create a token-based Lambda authorizer function and Create a request-based Lambda authorizer function.
Then, test the authorizer by calling your API with the required header and token value or the identity sources. To troubleshoot this type of error, verify the information that must be included in requests to your API by reviewing your Lambda authorizer's configuration. When an API Gateway API with a Lambda authorizer receives an unauthorized request, API Gateway returns a 401 Unauthorized response.Ĥ01 Unauthorized errors usually occur when a required token is missing or isn't validated by the authorizer's token validation expression.įor request parameter-based Lambda authorizersĤ01 Unauthorized errors usually occur when configured identity sources are missing, null, empty, or not valid. This article addresses only 401 Unauthorized response errors returned by API Gateway without calling the authorizer Lambda function. Note: API Gateway can return 401 Unauthorized errors for many reasons.
