In this example we're showing how to integrate existing database with user data using React and AWS Amplify with AWS Cognito. With this setup it is not only possible to query already existing database, but also to implement fully passwordless authentication, by sending tokens to users channel of choice (SMS or Email). Our implementation differs from the implementation found in the original post not only by frameworks used, but also by approach. In the original post, the authors implement passwordless authentication by sending a randomly generated token to users email address. They accomplish this with Typescript and Angular. In our approach, we focus on connecting already existing database containing user data with AWS Cognito using React.js. The only difference found in both aprooach (with the exception of choice of frameworks) lies in create-auth-challenge lambda, which in our case queries external database (mongoDB).
Based on https://github.com/aws-samples/amazon-cognito-passwordless-email-auth and https://aws.amazon.com/blogs/mobile/implementing-passwordless-email-authentication-with-amazon-cognito/