SeanPlusPlus
SeanPlusPlus

Reputation: 9043

Handling "Missing Authentication Token" after setting up AWS Lambda with API Gateway

Here are the exact steps I just followed to setup a Lambda function behind and API Gateway.

1. Select blueprint

enter image description here

2. Add trigger

enter image description here

3. Configure

enter image description here

4. Create Role

enter image description here

5. Create Function

enter image description here

6. Congrats

enter image description here

7. Deploy API

enter image description here

However, when I visit the endpoint:

https://hq1hf4tmlf.execute-api.us-west-2.amazonaws.com/prod/myLambda

I get the following error:

{
  "message": "Missing Authentication Token"
}

Upvotes: 0

Views: 4166

Answers (2)

gvn.miller
gvn.miller

Reputation: 46

The error you are getting is because the API key isn't included when you invoke the API through the URL alone.

With the way you currently have it set up, you would need to use something like python's requests package to call the API and invoke the lambda:

import requests CustomHeader = {'x-api-key': YOUR_API_KEY} Response = requests.get(YOUR_API_URL, headers=CustomHeader)

Or, you could go back into your API's configuration (under Your API/Resources/API Call/Method Request) and disable use of your API key for that call, but is a very insecure option.

Disable API Key Verification for API call.

Upvotes: 1

Pallav Kant
Pallav Kant

Reputation: 1

You may want to check if you have a web security service or web filtering proxy installed on your device that might be stripping off JWT/auth tokens from requests going out of your work/home network. I had the same problem where I was getting “Missing Authentication token” error while trying to create a lambda function on my work laptop. After struggling for few hours, I switched on to my personal laptop and was able to create the lambda function successfully in the first attempt. I then tried again on my work laptop with fiddler turned on and noticed that even though the auth credentials were setup properly in my outbound request, I was still getting “x-amzn-ErrorType: MissingAuthenticationTokenException” from AWS in the response. I turned off the web security proxy service on my work laptop and I was able to create Lambda functions successfully. Hope it helps.

Upvotes: 0

Related Questions