How it works...

The combination of the AWS API Gateway, AWS Cognito, and the Serverless Framework make securing a service with OpenID Connect extremely straightforward. The AWS API Gateway can use authorizer functions to control access to a service. These functions verify the JWT passed in the Authorization header and return an IAM policy. We will delve into these details in the Implementing a custom authorizer recipe. AWS Cognito provides an authorizer function that verifies the JWTs generated by a specific user pool. In the serverless.yml file, we simply need to set authorizer to the userPoolArn of the specific Cognito user pool. Once authorized, the API Gateway passes the decode claims from the JWT along to the lambda function in the ...

Get JavaScript Cloud Native Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.