Search code examples
amazon-web-servicesamazon-cognitoamazon-cloudfrontamazon-route53

How do I connect my AWS Cloudfront deployed sign-in page to AWS Cognito?


I want to create a user pool for the purposes of requiring authentication on my website. I have a website deployed using CloudFront. I have one hosted zone for this website on Route 53. I have tried setting up a Cognito, but I have been unsuccessful.

During the set up process, it asks for the app name. I can not figure out if this is asking for an existing app name or if I need to make one up. The significance of this step is not clear. Another step in the process has me enter the domain name, either an Amazon Cognito domain, or my own custom domain. I tried using an Amazon Cognito domain, but after following the AWS documentation and visiting my new domain, I only saw an error message.

sign-in error message

I wish to connect a pre-existing, and pre-deployed website with its own sign-in page to AWS Cognito, but I cannot find any solid guides on how to do so. Any help would be greatly appreciated.


Solution

  • After much searching and reading through numerous posts and documentation, I found the answer to my questions. I ended up following an AWS GitHub Wiki to set up the authentication flow.

    The Route 53 service ended up not being relevant for this task. Amplify is not required. The name of the Cognito app was not significant, it only gives the user pool an app name. On the AWS side, I had to create my own user pool following this AWS doc. On the website side, I had to create a user and a user pool in JavaScript using the SDK described in the linked wiki.

    The wiki lists different ways to install and include the Cognito SDK within a JavaScript project. The configuration steps needed to be tweaked slightly to fit within the framework I am using. Numerous use cases are covered.