Lambda, angular and cognito

Hi.

Im looking into cognito right now and just have a few questions before I begin implementing it.

On our solution there will be admins which will add users. So users cant sign up themselves.
When a user is signed up in cognito Ill need to have a reference from that user to a user in the database.

So I am planning to have a lambda function that registers users in cognito and then creates a user in the database with a reference to the cognito user.

Does that seem right? or should the ui call the cognito sdk directly to register the user and after that is done then call my lambda to create the user in the database?

When the user should login Im guessing the ui should use the cognito sdk directly? Id like it to go though my api gateway but Im afraid itl be a security risk.

Im having a hard time finding lambda examples that integrate with Cognito so if you have a link that would be great.

looking forward to hear from you =)

Regards Merc

Hi.

Completely forgot about this question. But should anyone else end up here in desprate search. This is a good place to start.

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentityServiceProvider.html

Regards Merc.