Gal Shahar
Gal Shahar

Reputation: 2815

Using AWS Cognito to authenticate users in my own api

I have an iOS app. Users are authenticated to access AWS resources like DynamoDB or S3. Now, I have built a node js server in order to add further logic to the app’s backend. My question is, can I use already authenticated users identity pool to allow those users to access my api (which hosted in EC2, by the way) or I need to create a whole new authentication system using passport.js or such. If I can use Cognito, does it cost money?

Thanks!

Upvotes: 0

Views: 503

Answers (1)

erik258
erik258

Reputation: 16302

if you put your API behind API Gateway, you could use AWS IAM authentication for the API Gateway, an approach I find compelling because it means unauthenticated requests to API gateway don't trigger a backend request, and because I like to let AWS do the authentication for me ( AWS auth is "free" though Cognito identity pools are not) . I also like that api gateway can do a request limit so that malicious authenticated users can't take their cognito tokens and make a DoS attack on say a dynamo table.

Otherwise I don't know a way to tie your application auth into AWS auth, so you're left bridging that gap with your own engineering effort.

Upvotes: 2

Related Questions