chapter five
5 Authentication and authorization with Cognito
This chapter covers:
- Authentication and authorization in serverless architecture
- JSON Web Tokens
- Amazon Cognito as a central service for authentication
One of the first questions we’re asked is usually about authentication and authorization in a serverless environment. Without a server, how does one authenticate users and secure access to resources? To help answer these questions, we introduce an AWS service called Cognito. We show how to set it up to provide user sign-up and login in a Serverless environment, and explain how it all works; you’ll love JSON Web Tokens. We follow this with the next chapter where we discuss how to build a serverless API, secure it with custom authorizers, and connect it to Lambda functions. However, before you can get to any of that exciting stuff we need to take a close look at Cognito and understand how it fits in.