a person
a person

Reputation: 1706

AWS Cognito + my own identity solution using DynamoDB?

Currently, I have a nodeJS API server that handles user authentication that I would like to continue using. I have an /authenticate endpoint that will authenticate users and return JWT that needs to be used for making authenticated API calls.

I would like to use AWS Cognito + DynamoDB for user authentication going forward. However, I'm totally overwhelmed by the various ways in which I can do this. I have come up with the following 2 ways of doing this, but not sure which is better in the long term.

  1. Use API Gateway + Lambda. This way, I can create new users by interfacing with DynamoDB, and authenticate using Cognito. So far I've just tried to just do some basic things with API Gateway + Lambda + DynamoDB, but haven't touched Cognito yet. It seems with this method I can have more flexibility down the road.
  2. Deploy my nodeJS application on AWS + API Gateway. Besides user authentication, I have about 8 other endpoints for other things. I feel like this method doesn't leverage many benefits of AWS but I can easily push new code and keep things running.

Or, is there another, better way? In summary, I have a REST API using nodeJS that I want to deploy on AWS but not sure the best way to do so. One of those endpoints is for authentication, while the others are all CRUD.

Upvotes: 2

Views: 726

Answers (3)

Vasileios Lekakis
Vasileios Lekakis

Reputation: 5572

Another good example application for what you are describing is here: https://github.com/awslabs/aws-serverless-auth-reference-app

It demonstrates, API-gateway, cognito, lamdda and dynamoDB working together for a room reservation application.

Upvotes: 0

izelrea
izelrea

Reputation: 173

I found an example of how to use cognito + Javascript: http://docs.aws.amazon.com/amazondynamodb/latest/gettingstartedguide/GettingStarted.Js.Summary.html "Configure AWS Credentials in Your Files Using Amazon Cognito"

Upvotes: 1

David Kierans
David Kierans

Reputation: 1599

So if I understand you correctly you want to look at how you can continue using the JWT approach you have but use DynamoDB as the backing store and the cognito capabilities to help with all the auth etc?

Maybe have a look at how to use Lambda, Cognito and DynamoDB with your own user management scheme

If you need any extra info just ask.

Upvotes: 1

Related Questions