Ondrej Tokar
Ondrej Tokar

Reputation: 5070

Getting error: Missing Authentication Token after AWS API request

I am trying to call a Lambda Function through AWS API Gateway.

I've been getting this error when I tried IAM authentication, API Key Authentication and also with no authentication. enter image description here

{"message":"Missing Authentication Token"}

Some people had the same problem due to non existing endpoint. However, I've taken my endpoint directly from the Lambda Function AWS Console. enter image description here

I've been trying to open the URL in the Browser and also on the Postman (with and without a header authentication: x-api-key: *****************). enter image description here

Both responded with above stated error.

Upvotes: 22

Views: 43535

Answers (5)

saber47
saber47

Reputation: 41

Just wanted to mention that if you set your API gateway's authentication to be NONE, make sure you need to Deploy API first before the no authentication setting is in effect.

Upvotes: 4

Atihska
Atihska

Reputation: 5126

You have to Enable CORS from the actions for the API. This will create a new OPTIONS method. CORS is for cross domain requests

Upvotes: -2

jackko
jackko

Reputation: 7344

I'll write up a detailed FAQ here for any viewers. Ordered by most common cause.

  1. Incorrect resource path and/or HTTP method.
    • If you have the right resource path and the wrong HTTP method, you'll still see this message
    • You can use Postman or some other client to sign a request to the same resource/method and if you get a 404 then you definitely have the wrong resource/method.
  2. Missing signature on protected resource/method. By default, your API will be open. If you have explicitly required AWS Auth then the error indicates that the request wasn't signed.
  3. If you're using the Lambda console to create an 'API Endpoint' it may be an issue on the Lambda end, or a delay in the propagation of the new API. In this case go to the API Gateway console and you should see the same API that Lambda created for you. Make sure it has been deployed and you have the right stage, resource path, and method.

Upvotes: 8

John Haller
John Haller

Reputation: 191

One more step: in Postman, you need to set the Authorization to AWS Signature, and then enter your AccessKey and SecretKey from your IAM user:

Postman screenshot Postman screenshot

Upvotes: 19

Mbrevda
Mbrevda

Reputation: 3080

You need to set Api Key Required to true. See more here: http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-api-keys.html

Upvotes: -2

Related Questions