Missing Authentication Token while accessing API Gateway?

前端 未结 18 1317
既然无缘
既然无缘 2020-12-08 12:51

I am trying to call a Lambda Function through AWS API Gateway. When I mention Authentication type NONE it works fine but API become public and anyone with url can access my

相关标签:
18条回答
  • 2020-12-08 13:18

    Make sure you are clicking on the specific Resource first in the Stages tree, as that will populate a URL with the full path to the resource (rather than just the root path):

    For other causes, see http://www.awslessons.com/2017/aws-api-gateway-missing-authentication-token/

    0 讨论(0)
  • 2020-12-08 13:19

    First of all, check whether the API you created in the lamda function is registered with your AWS project or not. For that, go to the API gateway in your AWS console. If it is not registered, register it. This is the main cause of this issue.

    You can even see in your aws.export.js file, that there are paths corresponding to your API ['/items'].

    Your API must be present there, otherwise it will not append the security token to requests. Just register it in your project cloud-logic in your console for this.

    If it's there, then use the above mentioned solution
    http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-use-postman-to-call-api.html

    0 讨论(0)
  • 2020-12-08 13:22

    I think you are directly trying to access API link, this won't work because API is secured using IAM role and you must provide AWS authentication i.e Access key and Secret key.

    Use the Postman Chrome extension to test your API: http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-use-postman-to-call-api.html

    0 讨论(0)
  • 2020-12-08 13:23

    sometimes this message shown when you are calling a wrong api

    check your api endpoint

    0 讨论(0)
  • 2020-12-08 13:24

    Make sure you create Resource and then create method inside it. That was the issue for me. Thanks

    0 讨论(0)
  • 2020-12-08 13:26

    To contribute:

    I had a similar error because my return response did not contain the 'body' like this:

    return { 'statusCode': 200, 'body': "must contain the body tag if you replace it won't work" }

    0 讨论(0)
提交回复
热议问题