I know this might be too late. But for people who have this issue, two ways you can secure your API endpoints depending on your scenario.
If you don't currently have a user directory (login/signup system), you can use Cognito User Pool to secure your Apis. The steps are
- in AWS Cognito console, create a Cognito User Pool
- in API Gateway console, create a Cognito User Pool Authorizer
- in your JS code, authenticate the user with the Cognito User Pool which will return return you a user token, then you can use the token in Authorization header when making Ajax calls to the api.
Here's a step-by-step tutorial on the process. I'd recommend start with the Create a Cognito user pool chapter.
http://serverless-stack.com/chapters/create-a-cognito-user-pool.html
The second scenario being if you already have a user directory either with Facebook/Twitter or any other social login. You will need to create a Cognito Identity Pool. You might find this answer useful.
To use a federated identity, you set the API Gateway method to use
“AWS_IAM” authorization. You use Cognito to create a role and
associate it with your Cognito identity pool. You then use the
Identity and Access Management (IAM) service to grant this role
permission to call your API Gateway method.