serverless-components / express

⚡ Take existing Express.js apps and host them easily on cheap, auto-scaling, serverless infrastructure (AWS Lambda and AWS HTTP API).
https://serverless.com/components
Apache License 2.0
375 stars 34 forks source link

How to add Cognito auth to the API? #51

Closed morgler closed 3 years ago

morgler commented 3 years ago

This is a question: How can I add an existing Cognito user pool (that I created with a traditional serverless.yml) to the REST Api of this component?

I'm looking for a functionality similar to what AWS Amplify offers. For this I would need this express component to take in a Cognito user pool id or arn for each path. Or is there another way to achieve a protected API with this component?

morgler commented 3 years ago

After posting this question I found https://www.npmjs.com/package/cognito-express, which helps to add protection to the API. However, I consider auth to be a basic part of an API and since this component also sets up the API Gateway, it might be an idea to include auth in the future.

I will close this issue, because the referenced gem seems to be a solution.