I recently launched a service to help SaaS businesses in Asia leverage SMS and WhatsApp to automate payment reminders and reduce customer churn. I use AWS Cognito for user registration and authentication.
AWS Cognito has 2 ways to manage users.
In this post, I’ll focus on user pools.
Cognito is a fully manages service and doesn’t require any hosting or maintenance. User pool was introduced in 2016 and the service and it’s API’s are mature at this point.
Here’s a list of features you get right out of the box with just a bit of configuration.
Here’s a sample serverless framework file to help you get started: Github Gist
Cognito allows you to add up to 25 custom attributes to a user record. These don’t include the 17 standard attributes such as a username, email, timezone, address, etc.
This is useful for associating the user with special information such as an admin role, linking a child and parent account for single billing, a third party service id for federation, etc.
Note: Once added, a custom attribute cannot be changed or deleted.
Custom authorizers are Lambda functions that are called before your main function to authenticate and/or authorize that the caller may proceed to your core function.
Cognito userpool already provides a default authorizer to confirm if he user is registered and if the username and password match whats on record, so why do we need a custom authorizer?
You would use this when you need to perform custom validations such as the following
Userpools triggers allow you to create custom workflows during user registration, authentication and token creation. There are currently 10 triggers. Some common use for triggers are:
Live Demo: https://aws-cognito-demo.netlify.app