Invoke API Gateway function with Cognito Authentication from Javascript

@dbeja Are you using the User Pool + Identity Pool setup? Or just Identify Pool?

If you are using Identity Pool federated with Facebook login, you might find this stackoverflow answer useful amazon web services - How to authenticate API Gateway calls with Facebook? - Stack Overflow

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.

And then use aws sdk in JS to invoke the apis

var apigateway = new AWS.APIGateway();

If you are using User Pool, you can authenticate your apis with the User Pool and include the Authentication header in your Ajax call. See the code here Call the Create API

1 Like