Quick Look – AWS Cognito


| February 12, 2019 | in

Amazon Web Services (AWS) makes many common cloud services easy to create and maintain. One of the many AWS services really makes easy is supporting authentication. One of them, Cognito, is a platform for authentication within the cloud.

Let’s walk through how to use Cognito along with AWS’s Amplify service to create an Angular application that supports authentication in the cloud.

We need to begin by creating an Angular Cognito user pool.

Go to the “Cognito” section within the AWS console. Click the “Create a User Pool” button and AWS will ask you a few questions about how you want your user pool created.

Create an Angular project

ng new AngularMobile

Now we can add Amplify to our Angular project.

Npm install --save aws-amplify
Npm install --save aws-amplify-angular

Now it’s time for the many-updates-to-Angular phase where we make many small tweaks to our Angular project.

Update main.ts

Update tsconfig.app.json

Update app.module.ts

Update polyfill.ts

Now we can use the Amplify service to do things such as sign in to our app.

I have a sample application for this on GitHub at https://github.com/chadmichel/AngularBlogPostSeries/tree/master/AWS_Amplify/AngularAmplifyExample

If you get stuck or have any questions, hit me up on Twitter or respond in the comments below.