Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS API Gateway Method Test: Error Authorization not configured

I've created a RESTful API on AWS and I'm trying to test the POST method. I give a sample request to the the request body in the api gatemway console's test interface it get this response:

{
  "Error": "Authorization not configured",
  "Reference": "e6b7ec86-97fe-11e7-b480-ebefe7f11420"
}

I originally had this set to a Cognito User Pool with read/write access to a corresponding table, but I got this error message. I tried removing authorization in the method just to test this, but again I received this error.

As far as I can tell, I have authorization set up across the board.

  • IAM role created to add, update, query, and delete, from table (trusted entities: AWS service: lambda) and the AWSLambdaBasicExecutionRole
  • Lambda function using an existing (above) role
  • authorizer created using my User Pool for authorization
  • resource and method (POST) created using cognito user pool authorizer from above

I feel like I must be missing something obvious, but everything seems to be in order as I step through it here. Any help is much appreciated and please let me know if I can provide any additional information.

like image 659
Justin Kruse Avatar asked Sep 12 '17 21:09

Justin Kruse


2 Answers

I found this question linked from the AWS forums The OP there and I both ran into this same problem while going through the Wild Rydes tutorial.

I was able to solve this problem by:

  1. In the API's settings under "Resources", click on the "POST" method, then click on "Method Request".

enter image description here

  1. In the Method Request settings, click the edit icon for "Authorization"

enter image description here

  1. Choose the Cognito pool.

enter image description here

  1. Click the check icon to save the change

enter image description here

Once the change is made, the method request should no longer say None for auth

enter image description here

  1. Redeploy the API.

enter image description here

like image 186
imjosh Avatar answered Oct 06 '22 01:10

imjosh


If anyone else is having this problem, I simply had to clear my cached data on my browser for it to work.

like image 26
Shaun Avatar answered Oct 06 '22 01:10

Shaun